jekyll/jekyll-seo-tag

Do not emit author name as twitter:creator

kenrose opened this issue · 2 comments

Summary

Authors defined in authors.yml that do not have a twitter handle have incorrect output for twitter:creator.

Details

I run a Jekyll blog with several authors. Author information is kept in _data/authors.yml as described in the Advanced Guide. e.g.,:

ken:
  name: Ken Rose
  picture: /img/kenrose.png
  twitter: klprose

john:
  name: John Doe
  picture: /img/john.png

Some authors (like john) do not have Twitter accounts, so we do not specify a twitter handle for them.

Unfortunately, it appears that jekyll-seo-tag defaults to using their name as the value for twitter:creator in that case. e.g., for john above, the following will be generated:

<meta name="twitter:creator" content="@John Doe" />

That's clearly not right.

We want name to be set properly so that we can have the author meta tag set. e.g., the following is correct:

<meta name="author" content="John Doe" />

Investigation

The issue seems to be in author_drop.rb:

twitter = author_hash["twitter"] || author_hash["name"]

Historically, it looks like this is a holdover from some time when author support was less robust and it was assumed that an author's name was their Twitter handle.

Ideas for a fix

I'm not sure what the best fix is here. Here are some ideas:

  1. Treat twitter: null in the author's YAML as an explicit signal that there is no twitter handle. e.g.,

    twitter = author_hash.key?("twitter") ? author_hash["twitter"] : author_hash["name"]
  2. If an author_hash is present, only look at twitter for the handle and don't fall back to name. This would be a breaking change though.

I have already noticed this problem too. Hope your proposal can be accepted by the administrators.

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.