Skip to content

Commit 6c5187d

Browse files
authored
Add support for author in YAML parameters (daattali#1220)
1 parent a206f70 commit 6c5187d

7 files changed

Lines changed: 30 additions & 9 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Unreleased version
2-
32
- BREAKING CHANGE: Allow changing the order of the social network links that appear in the footer (#1152)
4-
- BREAKING CHANGE: `google-scholar` social network link no longer requires the prefix `citations?user=`; if you previously set this parameter, it needs to be updated (#1189)
5-
- Fixed bug where hovering over search results showed the text "{desc}" (#1156)
3+
- BREAKING CHANGE: `google-scholar` social network link no longer requires the prefix `citations?user=`; if you previously set this parameter, it needs to be updated (#1189)
4+
- Added `author` YAML parameter to allow specifying the author(s) of a post (#1220)
5+
- Fixed bug where hovering over search results showed the text "{desc}" (#1156)
66
- Added social network links for GitLab, Bluesky (#1168, #1218)
77
- Added instructions and example on how to fix image links in project sites (#1171)
88
- Pagination buttons: use nicer arrows, and don't show text on small screens (#1221)

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ These are parameters that you may not use often, but can come in handy sometimes
164164

165165
Parameter | Description
166166
----------- | -----------
167+
author | Specify the author of a blog post (useful if a website has multiple authors).
167168
readtime | If you want a post to show how many minutes it will take to read it, use `readtime: true`.
168169
show-avatar | If you have an avatar configured in the `_config.yml` but you want to turn it off on a specific page, use `show-avatar: false`.
169170
social-share | By default, every blog post has buttons to share the page on social media. If you want to turn this feature off, use `social-share: false`.

‎_includes/head.html‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@
2525

2626
<title>{{ title }}</title>
2727

28-
{% if site.author %}
29-
<meta name="author" content="{{ site.author }}">
28+
{% capture author %}
29+
{%- if page.author -%}
30+
{{ page.author | strip_html }}
31+
{%- elsif site.author -%}
32+
{{ site.author }}
33+
{%- endif -%}
34+
{% endcapture %}
35+
{% if author != "" %}
36+
<meta name="author" content="{{ author }}">
3037
{% endif %}
3138

3239
<meta name="description" content="{{ description }}">
@@ -112,7 +119,9 @@
112119

113120
{% if page.id %}
114121
<meta property="og:type" content="article">
115-
<meta property="og:article:author" content="{{ site.author }}">
122+
{% if author != "" %}
123+
<meta property="og:article:author" content="{{ author }}">
124+
{% endif %}
116125
<meta property="og:article:published_time" content="{{ page.date | date_to_xmlschema }}">
117126
<meta property="og:url" content="{{ page.url | absolute_url }}">
118127
<link rel="canonical" href="{{ page.url | absolute_url }}">

‎_includes/header.html‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ <h1>{% if page.title %}{{ page.title | strip_html }}{% else %}<br/>{% endif %}</
3636
<h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
3737
{% endif %}
3838
{% endif %}
39-
40-
{% if include.type == "post" %}
39+
40+
{% if include.type == "post" %}
41+
{% if page.author %}
42+
By <strong>{{ page.author | strip_html }}</strong><br>
43+
{% endif%}
4144
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
4245
{% if page.last-updated %}
4346
<span class="post-meta">
@@ -71,7 +74,10 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
7174
{% endif %}
7275
{% endif %}
7376

74-
{% if include.type == "post" %}
77+
{% if include.type == "post" %}
78+
{% if page.author %}
79+
By <strong>{{ page.author | strip_html }}</strong><br>
80+
{% endif%}
7581
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
7682
{% if page.last-updated %}
7783
<span class="post-meta">

‎_layouts/home.html‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ <h3 class="post-subtitle">
4646
{% endif %}
4747
</a>
4848

49+
{% if post.author %}
50+
<span>By <strong>{{ post.author | strip_html }}</strong></span>
51+
{% endif %}
4952
<p class="post-meta">
5053
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
5154
Posted on {{ post.date | date: date_format }}

‎_posts/2020-02-26-flake-it-till-you-make-it.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cover-img: /assets/img/path.jpg
66
thumbnail-img: /assets/img/thumb.png
77
share-img: /assets/img/path.jpg
88
tags: [books, test]
9+
author: Sharon Smith and Barry Simpson
910
---
1011

1112
Under what circumstances should we step off a path? When is it essential that we finish what we start? If I bought a bag of peanuts and had an allergic reaction, no one would fault me if I threw it out. If I ended a relationship with a woman who hit me, no one would say that I had a commitment problem. But if I walk away from a seemingly secure route because my soul has other ideas, I am a flake?

‎_posts/2020-02-28-sample-markdown.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gh-repo: daattali/beautiful-jekyll
66
gh-badge: [star, fork, follow]
77
tags: [test]
88
comments: true
9+
author: Bill Smith
910
---
1011

1112
{: .box-success}

0 commit comments

Comments
 (0)