From ee265de976880f7cb08b30c431d0e081849d0ba9 Mon Sep 17 00:00:00 2001 From: Bud Parr Date: Wed, 19 Apr 2017 16:45:24 -0400 Subject: [PATCH] improve image handling for edge cases Fixes #11 --- layouts/partials/page-header.html | 6 ++++-- layouts/partials/site-header.html | 6 ++++-- layouts/partials/summary-with-image.html | 5 ++++- 3 files changed, 12 insertions(+), 5 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 }} -
+ {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}} + {{ $featured_image := (trim $featured_image "/") | absURL }} +
{{ partial "site-navigation.html" . }}
diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html index dce121e..de2c3df 100755 --- a/layouts/partials/site-header.html +++ b/layouts/partials/site-header.html @@ -1,6 +1,8 @@ -{{ $featured_image := $.Param "featured_image" }} +{{ $featured_image := .Params.featured_image | default .Site.Params.featured_image }} {{ if $featured_image }} -
+ {{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}} + {{ $featured_image := (trim $featured_image "/") | absURL }} +
{{ partial "site-navigation.html" .}}
diff --git a/layouts/partials/summary-with-image.html b/layouts/partials/summary-with-image.html index d72cb35..63dc1f4 100644 --- a/layouts/partials/summary-with-image.html +++ b/layouts/partials/summary-with-image.html @@ -1,9 +1,12 @@ +{{ $featured_image := .Params.featured_image }}