Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google rel="publisher" shall be link tag #282

Merged

Conversation

jrbenito
Copy link
Contributor

Configuration

  • Operating system with version : Ubuntu (doesn´t matter)
  • Node version : 4.4.3 (doesn´t matter)
  • Hexo version : 3.2.0 (doesn´t matter)
  • Hexo-cli version : --

Changes proposed

  • Change to to avoid HTML 5 validation errors.

Actual Google rel="publisher" is generated as tag. This causes
errors in HTML5 validation because has no attribute "rel" and
also, shall have a name, itemprop, property or http-equive
attributes. Changing it to tag solves these validations errors.
It is important to notice that rel="publisher" is meant to link a Google+
business page and not to individuals G+ page. So a new property was
created to hold G+ business page and put it in this tag if available.

Notice: This is compatible with old behavior since if no business page is provided the personal business page is linked as before. No functionality break.

Signed-off-by: Josenivaldo Benito Jr jrbenito@benito.qsl.br

Actual Google rel="publisher" is generated as <meta> tag. This causes
errors in HTML5 validation because <meta> has no attribute "rel" and
also, <meta> shall have a name, itemprop, property or http-equive
attributes.

Changing it to <link> tag solves these validations errors and makes
Google rich snippets work. It is important to notie that rel="publisher"
is meant to link a Google+ business page and not to individuals G+ page.
I don´t know if this affects or not the result but for future we shall
think in have a 'business' property in theme _config.yml and author´s as
already set. Then we might create rel="publisher" pointing to the
business and rel="author" linking to author´s G+ page.

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
This modification adds `author.google_plus_business` and puts it into
`rel=plublisher` tag if set in _config.yml.

Note: This is compatible with old _config.yml because if new property is
not set it uses old one instead (`author.google_plus`).

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
@jrbenito
Copy link
Contributor Author

@LouisBarranqueiro this substitutes #276

@jrbenito
Copy link
Contributor Author

I forgot to mention, Google has dropped authorship in SERPs and as per their declarations, "rel=author" is now being ignored by Google. However, "rel=publisher" and schema.org markups are still valid. Hence, this patch keep "rel=publisher" and does not care about "rel=author" as we first thought to do.

@LouisBarranqueiro
Copy link
Owner

Hey buddy, can we link 2 publishers in a page, in the case, the user filled the 2 fields?

  1. You did a mistake in your code:
if (theme.author.google_plus_business) {
  publisher = theme.author.google_plus_business;  // not theme.author.google_plus
}
else if (theme.author.google_plus) {
  publisher = theme.author.google_plus;
}
  1. Improvement
    Since you define publisher to an empty string, you can use a shortcut to test it :
if (publisher)

it evaluate to true if publisher is not:

  • null
  • undefined
  • NaN
  • empty string ('')
  • 0
  • false

@jrbenito
Copy link
Contributor Author

jrbenito commented Jul 6, 2016

Hey!

  1. You did a mistake in your code:

Thanks for point my dumb and blind copy&paste.

Improvement Since you define publisher to an empty string, you can use a shortcut to test it

👍 Nice! Thanks

can we link 2 publishers in a page, in the case, the user filled the 2 fields?

I don´t think so, in fact, as far as I can tell the publisher has effect with G+ business pages but its effect with personal page is not clear. Since theme already use personal page in the publisher link, I though to keep compatibility with older versions by choosing between both. In other words: if the user does not have a business page or already set the business page to theme.author.google_plus nothing changes. If the user set both, than theme.author.google_plus_business is used for publisher and author used to "rel=me" link on side bar only.

Anyway, we need still set publisher and author of BlogPosting schem using those two variables. I will try to PR this one too.

Correct attribuition of publisher

Signed-off-by: Josenivaldo Benito Jr <jrbenito@benito.qsl.br>
@LouisBarranqueiro LouisBarranqueiro merged commit f175f0e into LouisBarranqueiro:dev Jul 10, 2016
@LouisBarranqueiro
Copy link
Owner

Thanks :)

@jrbenito jrbenito deleted the link-rel-improvement branch July 14, 2016 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants