blog/_includes/views/banner.html
jeffreytse cae6e2e549 feat: support advanced banner configuration
Support to configurate the banner opacity and height.
2021-06-17 20:39:11 +08:00

60 lines
1.7 KiB
HTML

{%- include functions.html func='log' level='debug' msg='Get banner_html value' -%}
{% assign name = 'banner_html' %}
{%- include functions.html func='get_value' -%}
{% assign banner_html = return %}
{%- include functions.html func='log' level='debug' msg='Get heading value' -%}
{% assign name = 'heading' %}
{%- include functions.html func='get_value' -%}
{% assign heading = return %}
{%- include functions.html func='log' level='debug' msg='Get subheading value' -%}
{% assign name = 'subheading' %}
{%- include functions.html func='get_value' -%}
{% assign subheading = return %}
{%- include functions.html func='get_banner' -%}
{% if banner_image %}
<style>
html .page-banner {
height: {{ banner_height }};
}
html .page-banner .page-banner-img > *:first-child {
opacity: {{ banner_opacity }};
}
html[data-theme="dark"] .page-banner .page-banner-img > *:first-child {
opacity: {{ banner_opacity | times: 0.6 }};
}
</style>
<section class="page-banner">
<div class="page-banner-img">
<div style="background-image: url({{ banner_image }})"></div>
</div>
<div class="wrapper">
<div class="page-banner-inner">
{%- if banner_html -%}
{%- assign banner_html = 'views/' | append: banner_html -%}
{%- include {{ banner_html }} -%}
{%- else -%}
<div class="page-banner-default">
<h1 class="page-banner-heading">
{{ heading | default: page.title | escape }}
</h1>
<h2 class="page-banner-subheading">
{{ subheading | default: page.subtitle | escape }}
</h2>
</div>
{%- endif -%}
</div>
</div>
</section>
{%- endif -%}