feat: support banner heading and subheading styles

This commit is contained in:
jeffreytse 2021-06-25 14:16:44 +08:00
parent 245fe2a047
commit 404a26e6a9
4 changed files with 28 additions and 1 deletions

View file

@ -152,6 +152,8 @@ yat:
# background: "rgba(0, 0, 0, 0.8)"
# height: "640px"
# min_height: null
# heading_style: null # Custom heading style (e.g. "font-weight: bold; text-decoration: underline")
# subheading_style: null # Custom subheading style (e.g. color: gold)
# Excerpt size setting
# excerpt_size: 350

View file

@ -31,3 +31,14 @@
{% assign name = 'banner.min_height' %}
{%- include functions.html func='get_value' -%}
{% assign banner_min_height = return %}
{%- include functions.html func='log' level='debug' msg='Get banner_heading_style value' -%}
{% assign name = 'banner.heading_style' %}
{%- include functions.html func='get_value' -%}
{% assign banner_heading_style = return %}
{%- include functions.html func='log' level='debug' msg='Get banner_subheading_style value' -%}
{% assign name = 'banner.subheading_style' %}
{%- include functions.html func='get_value' -%}
{% assign banner_subheading_style = return %}

View file

@ -49,6 +49,20 @@
}
</style>
{% endif %}
{%- if banner_heading_style -%}
<style>
html .page-banner .page-banner-inner > *:first-child > *:nth-child(1) {
{{ banner_heading_style }}
}
</style>
{%- endif -%}
{%- if banner_subheading_style -%}
<style>
html .page-banner .page-banner-inner > *:first-child > *:nth-child(2) {
{{ banner_subheading_style }}
}
</style>
{%- endif -%}
<section class="page-banner">
<div class="page-banner-img">
<div style="background-image: url({{ banner_image }})"></div>

View file

@ -1,6 +1,6 @@
<header class="post-header">
<h1 class="post-title p-name" itemprop="name headline">{{ heading | default: page.title | escape }}</h1>
<h3 class="post-subtitle">{{ subheading | default: page.subtitle | escape }}</h3>
<h2 class="post-subtitle">{{ subheading | default: page.subtitle | escape }}</h2>
<p class="post-meta">
<time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}" itemprop="datePublished">