jekyll / jekyll-seo-tag

A Jekyll plugin to add metadata tags for search engines and social networks to better index and display your site's content.
https://jekyll.github.io/jekyll-seo-tag
MIT License
1.66k stars 294 forks source link

Do not emit author name as twitter:creator #439

Closed kenrose closed 3 years ago

kenrose commented 3 years ago

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.

zivong commented 3 years ago

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

jekyllbot commented 3 years ago

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.