remove ruby author logic

This commit is contained in:
Ben Balter 2016-02-20 17:34:02 -05:00
parent 068a1b972a
commit 782729fad2
2 changed files with 15 additions and 35 deletions

View File

@ -17,20 +17,12 @@ module Jekyll
def payload
{
'seo_tag' => { 'version' => VERSION, 'author' => author },
'page' => page,
'site' => site
'seo_tag' => { 'version' => VERSION },
'page' => context.registers[:page],
'site' => context.registers[:site].site_payload['site']
}
end
def page
context.registers[:page]
end
def site
context.registers[:site].site_payload['site']
end
def info
{
registers: context.registers,
@ -53,28 +45,6 @@ module Jekyll
File.expand_path './template.html', File.dirname(__FILE__)
end
end
# Returns a hash representing the post author
#
# Sources, in order:
#
# 1. page.author, if page.author is a hash
# 2. site.author, if site.author is a hash
# 3. site.data.authors[page.author] if page.author is a string
# 4. page.author if page.author is a string
def author
author = page['author'] || site['author']
return if author.nil?
return author if author.is_a?(Hash)
if author.is_a?(String)
if site['data']['authors'] && site['data']['authors'][author]
site['data']['authors'][author]
else
{ 'twitter' => author }
end
end
end
end
end

View File

@ -39,8 +39,18 @@
{% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %}
{% endif %}
{% if seo_tag.author %}
{% assign seo_author_twitter = seo_tag.author.twitter | replace:"@","" %}
{% assign seo_author = page.author | default: site.author %}
{% if seo_author %}
{% if seo_author.twitter %}
{% assign seo_author_twitter = seo_author.twitter %}
{% else %}
{% if site.data.authors and site.data.authors[seo_author] %}
{% assign seo_author_twitter = site.data.authors[seo_author].twitter %}
{% else %}
{% assign seo_author_twitter = seo_author %}
{% endif %}
{% endif %}
{% assign seo_author_twitter = seo_author_twitter | replace:"@","" %}
{% endif %}
{% if seo_title %}