From ffcd9a1da9167e1567bad8f6a4600b1afcc1d8a1 Mon Sep 17 00:00:00 2001 From: Pat Hawks Date: Wed, 3 Feb 2016 19:35:35 -0800 Subject: [PATCH] Lookup author in site.data.authors --- lib/template.html | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/template.html b/lib/template.html index 871348b..d432727 100644 --- a/lib/template.html +++ b/lib/template.html @@ -36,11 +36,36 @@ {% endif %} {% if page.author %} - {% assign seo_author_name = page.author.name | default: page.author %} - {% assign seo_author_twitter = page.author.twitter | default: page.author %} + {% if site.data.authors[page.author] %} + {% assign seo_author_name = site.data.authors[page.author].name %} + {% assign seo_author_twitter = site.data.authors[page.author].twitter | default: seo_author_name %} + {% elsif page.author.name %} + {% assign seo_author_name = page.author.name %} + {% assign seo_author_twitter = page.author.twitter | default: seo_author_name %} + {% elsif page.author.twitter %} + {% assign seo_author_twitter = page.author.twitter %} + {% assign seo_author_twitter = page.author.twitter %} + {% else %} + {% assign seo_author_name = page.author %} + {% assign seo_author_twitter = page.author %} + {% endif %} +{% elsif site.author %} + {% if site.data.authors[site.author] %} + {% assign seo_author_name = site.data.authors[site.author].name %} + {% assign seo_author_twitter = site.data.authors[site.author].twitter | default: seo_author_name %} + {% elsif site.author.name %} + {% assign seo_author_name = site.author.name %} + {% assign seo_author_twitter = site.author.twitter | default: seo_author_name %} + {% else %} + {% assign seo_author_name = site.author %} + {% assign seo_author_twitter = site.author %} + {% endif %} +{% endif %} +{% if seo_author_name %} + {% assign seo_author_name = seo_author_name | strip_html | escape_once %} {% endif %} {% if seo_author_twitter %} - {% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" %} + {% assign seo_author_twitter = seo_author_twitter | replace:"@","" | prepend:"@" | strip_html | escape_once %} {% endif %} {% if seo_title %}