feat: replace extra.author with authors in the page front matter

This commit is contained in:
st1020 2024-07-31 21:17:16 +08:00
parent c2a7f409f0
commit 5371faac79
2 changed files with 20 additions and 7 deletions

View file

@ -17,8 +17,19 @@
{% set page_title = page.title | default(value=config.title) %} {% set page_title = page.title | default(value=config.title) %}
<!----> <!---->
{% set description = page.description | default(value=page_title) %} {% set description = page.description | default(value=page_title) %}
<!---->
{% if page.authors | length > 0 %}
<!---->
{% set author = page.authors | join(sep=", ") %}
<!---->
{% else %}
<!---->
{% set author = config.author | default(value=config.title) %}
<!---->
{% endif %}
<!---->
<meta name="description" content="{{ description }}" /> <meta name="description" content="{{ description }}" />
<meta name="author" content="{{ page.extra.author | default(value=page_title) }}" /> <meta name="author" content="{{ author }}" />
<!-- The Open Graph protocol --> <!-- The Open Graph protocol -->
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
<meta property="og:title" content="{{ page_title }}" /> <meta property="og:title" content="{{ page_title }}" />
@ -109,8 +120,7 @@
title="Atom" title="Atom"
href="{{ get_url(path=`atom.xml`) }}" href="{{ get_url(path=`atom.xml`) }}"
/> />
{% endif %} {% endif %} {% if "rss.xml" in config.feed_filenames %}
{% if "rss.xml" in config.feed_filenames %}
<link <link
rel="alternate" rel="alternate"
type="application/rss+xml" type="application/rss+xml"

View file

@ -4,10 +4,13 @@
<span class="mx-1">&middot;</span> <span class="mx-1">&middot;</span>
<span>{{ page.reading_time }}min</span> <span>{{ page.reading_time }}min</span>
{% endif %}<!----> {% endif %}<!---->
{% set single_author = page.extra.author | default(value=config.author) %} {% if page.authors | length > 0 %}<!---->
<!----> {% set author = page.authors | join(sep=", ") %}<!---->
{% if single_author %} {% else %}<!---->
{% set author = config.author %}<!---->
{% endif %}<!---->
{% if author %}
<span class="mx-1">&middot;</span> <span class="mx-1">&middot;</span>
<span>{{ single_author }}</span> <span>{{ author }}</span>
{% endif %} {% endif %}
</div> </div>