Skip to content

Commit d2af4de

Browse files
committed
Liquid templating fixes
1 parent 043e134 commit d2af4de

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

_includes/banner.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
<!-- Banner -->
22

3-
<section id="banner" style="background-image: url('{{ page.banner_background }}'); background-size: cover; background-position: center;">
3+
<section id="banner" class="banner-section">
4+
<style>
5+
.banner-section {
6+
background-image: url('{% if page.banner_background contains "://" %}{{ page.banner_background }}{% else %}{{ site.baseurl }}/{{ page.banner_background | remove_first: "/" }}{% endif %}');
7+
background-size: cover;
8+
background-position: center;
9+
}
10+
</style>
11+
<div class="inner">
12+
{% else %}
13+
{% assign banner_bg_final = site.baseurl | append: "/" | append: banner_bg_url | remove_first: "/" %}
14+
{% endif %}
15+
16+
<section id="banner"
17+
style="background-image: url('{{ banner_bg_final }}'); background-size: cover; background-position: center;">
418
<div class="inner">
519
<h2>{{ page.banner_heading }}</h2>
620
<p>{{ page.banner_text | markdownify }}</p>

_layouts/page.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE HTML>
22
<!--
3-
Spectral by HTML5 UP
4-
html5up.net | @ajlkn
5-
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
3+
Spectral by HTML5 UP
4+
html5up.net | @ajlkn
5+
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
66
-->
77
<html>
88
{% include head.html %}
@@ -12,21 +12,26 @@
1212

1313
<!-- Main -->
1414
<article id="main">
15-
<header{% if page.image %} style="background-image: url('{% if site.featured-image-source %}{{ page.image | prepend: site.featured-image-source | absolute_url }}{% else %}{{ "" | absolute_url }}/assets/images/{{ page.image }}{% endif %}');"{% endif %}>
15+
{% if page.image %}
16+
{% if site.featured-image-source %}
17+
{% assign header_image_url = page.image | prepend: site.featured-image-source | absolute_url %}
18+
{% else %}
19+
{% assign header_image_url = "/assets/images/" | append: page.image | absolute_url %}
20+
{% endif %}
21+
{% endif %}
22+
23+
<header{% if page.image %} style="background-image: url('{{ header_image_url }}');"{% endif %}>
1624
<h2>{{ page.title }}</h2>
1725
<p>{{ page.description }}</p>
1826
</header>
27+
1928
<section class="wrapper style5">
2029
<div class="inner">
21-
2230
{{ content }}
23-
2431
</div>
2532
</section>
2633
</article>
2734

2835
{% include footer.html %}
29-
3036
</body>
31-
3237
</html>

0 commit comments

Comments
 (0)