From 96a16c868ede51e7dfa412de63ffa1e5a49add7f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 17 Mar 2022 00:29:00 +0800 Subject: [PATCH] fix: correct the `twitter:creator` of Twitter summary card --- _data/authors.yml | 17 +++++++++++++++++ _layouts/post.html | 6 +++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 _data/authors.yml diff --git a/_data/authors.yml b/_data/authors.yml new file mode 100644 index 00000000000..f012012135a --- /dev/null +++ b/_data/authors.yml @@ -0,0 +1,17 @@ +## Template › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/advanced-usage.md#setting-author-url +# ------------------------------------- +# {author_id}: +# name: {full name} +# twitter: {twitter_of_author} +# url: {homepage_of_author} +# ------------------------------------- + +cotes: + name: Cotes Chung + twitter: cotes2020 + url: https://github.com/cotes2020/ + +sille_bille: + name: Dinesh Prasanth Moluguwan Krishnamoorthy + twitter: dinesh_MKD + url: https://github.com/SilleBille/ diff --git a/_layouts/post.html b/_layouts/post.html index 48e1d757d9b..e571d71b543 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -37,11 +37,11 @@

{{ page.title }}

- {% capture author_name %}{{ page.author.name | default: site.social.name }}{% endcapture %} + {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} {% assign author_link = nil %} - {% if page.author.link %} - {% assign author_link = page.author.link %} + {% if page.author %} + {% assign author_link = site.data.authors[page.author].url %} {% elsif author_name == site.social.name %} {% assign author_link = site.social.links[0] %} {% endif %}