From 2336f0108527d293e2b399f96b54c813a9903cbb Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Wed, 23 Oct 2013 22:16:02 -0500 Subject: [PATCH 1/2] Implemented per-page or site-wide background images. If the user sets "background: /path/to/image.jpg" or an http(s) url in their _config.yml, or if they set it in a post/page's yaml front matter, the displayed page will use that image as the background. If their background is transparent, the default background color will also be visible. Setting a background in a page/post will take precedence over the one set in _config.yml. --- _includes/head.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_includes/head.html b/_includes/head.html index bb238e4377..767c2dfd4f 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -56,3 +56,11 @@ + + +{% if page.background %} + {% capture page_bgimg %}{% if page.background contains 'http' %}{{ page.background }}{% else %}{{ site.url }}{{ page.background }}{% endif %}{% endcapture %} +{% elsif site.background %} + {% capture page_bgimg %}{% if site.background contains 'http' %}{{ site.background }}{% else %}{{ site.url }}{{ site.background }}{% endif %}{% endcapture %} +{% endif %} +{% if page_bgimg %}{% endif %} From 24970043deb37adabb10ec8deb2cb6df83bf5a4a Mon Sep 17 00:00:00 2001 From: Robpol86 Date: Sat, 26 Oct 2013 13:20:16 -0700 Subject: [PATCH 2/2] Implemented mmistakes' suggestions. All background images will now be consistent with the rest of the theme and pull background images from the site's /images location. Also moved per-page background yaml declaration into the images: "group" or array thing (whatever it's called). This is also consistent with the rest of the theme. --- _includes/head.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index 767c2dfd4f..915b5e3735 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -57,10 +57,6 @@ - -{% if page.background %} - {% capture page_bgimg %}{% if page.background contains 'http' %}{{ page.background }}{% else %}{{ site.url }}{{ page.background }}{% endif %}{% endcapture %} -{% elsif site.background %} - {% capture page_bgimg %}{% if site.background contains 'http' %}{{ site.background }}{% else %}{{ site.url }}{{ site.background }}{% endif %}{% endcapture %} +{% if page.image.background or site.background %} + {% endif %} -{% if page_bgimg %}{% endif %}