From ee265de976880f7cb08b30c431d0e081849d0ba9 Mon Sep 17 00:00:00 2001
From: Bud Parr <budparr@gmail.com>
Date: Wed, 19 Apr 2017 20:45:24 +0000
Subject: [PATCH] improve image handling for edge cases Fixes #11

---
 layouts/partials/page-header.html |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html
index 9e408ce..e6e7431 100644
--- a/layouts/partials/page-header.html
+++ b/layouts/partials/page-header.html
@@ -1,6 +1,8 @@
-{{ $featured_image := $.Param "featured_image" }}
+{{ $featured_image := .Params.featured_image }}
 {{ if $featured_image }}
-  <header class="cover bg-center" style="background-image: url('{{ $featured_image | absURL }}');">
+  {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
+  {{ $featured_image := (trim $featured_image "/") | absURL }}
+  <header class="cover bg-center" style="background-image: url('{{ $featured_image }}');">
     <div class="pb3-m pb6-l bg-black-60">
       {{ partial "site-navigation.html" . }}
       <div class="tc-l pv6 ph3 ph4-ns">

--
Gitblit v1.10.0