Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for front matter tag author: to add a by line to posts, w… #1220

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Unreleased version

- BREAKING CHANGE: Allow changing the order of the social network links that appear in the footer (#1152)
- 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)
- Fixed bug where hovering over search results showed the text "{desc}" (#1156)
- 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)
- Added `author` YAML parameter to allow specifying the author(s) of a post (#1220)
- Fixed bug where hovering over search results showed the text "{desc}" (#1156)
- Added social network links for GitLab, Bluesky (#1168, #1218)
- Added instructions and example on how to fix image links in project sites (#1171)
- Pagination buttons: use nicer arrows, and don't show text on small screens (#1221)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ These are parameters that you may not use often, but can come in handy sometimes

Parameter | Description
----------- | -----------
author | Specify the author of a blog post (useful if a website has multiple authors).
readtime | If you want a post to show how many minutes it will take to read it, use `readtime: true`.
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`.
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`.
Expand Down
15 changes: 12 additions & 3 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,15 @@

<title>{{ title }}</title>

{% if site.author %}
<meta name="author" content="{{ site.author }}">
{% capture author %}
{%- if page.author -%}
{{ page.author | strip_html }}
{%- elsif site.author -%}
{{ site.author }}
{%- endif -%}
{% endcapture %}
{% if author != "" %}
<meta name="author" content="{{ author }}">
{% endif %}

<meta name="description" content="{{ description }}">
Expand Down Expand Up @@ -112,7 +119,9 @@

{% if page.id %}
<meta property="og:type" content="article">
<meta property="og:article:author" content="{{ site.author }}">
{% if author != "" %}
<meta property="og:article:author" content="{{ author }}">
{% endif %}
<meta property="og:article:published_time" content="{{ page.date | date_to_xmlschema }}">
<meta property="og:url" content="{{ page.url | absolute_url }}">
<link rel="canonical" href="{{ page.url | absolute_url }}">
Expand Down
12 changes: 9 additions & 3 deletions _includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ <h1>{% if page.title %}{{ page.title | strip_html }}{% else %}<br/>{% endif %}</
<h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
{% endif %}
{% endif %}

{% if include.type == "post" %}

{% if include.type == "post" %}
{% if page.author %}
By <strong>{{ page.author | strip_html }}</strong><br>
{% endif%}
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% if page.last-updated %}
<span class="post-meta">
Expand Down Expand Up @@ -71,7 +74,10 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle | strip_html }}</h2>
{% endif %}
{% endif %}

{% if include.type == "post" %}
{% if include.type == "post" %}
{% if page.author %}
By <strong>{{ page.author | strip_html }}</strong><br>
{% endif%}
<span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% if page.last-updated %}
<span class="post-meta">
Expand Down
3 changes: 3 additions & 0 deletions _layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ <h3 class="post-subtitle">
{% endif %}
</a>

{% if post.author %}
<span>By <strong>{{ post.author | strip_html }}</strong></span>
{% endif %}
<p class="post-meta">
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
Posted on {{ post.date | date: date_format }}
Expand Down
1 change: 1 addition & 0 deletions _posts/2020-02-26-flake-it-till-you-make-it.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cover-img: /assets/img/path.jpg
thumbnail-img: /assets/img/thumb.png
share-img: /assets/img/path.jpg
tags: [books, test]
author: Sharon Smith and Barry Simpson
---

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?
Expand Down
1 change: 1 addition & 0 deletions _posts/2020-02-28-sample-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ gh-repo: daattali/beautiful-jekyll
gh-badge: [star, fork, follow]
tags: [test]
comments: true
author: Bill Smith
---

{: .box-success}
Expand Down