HTML5 valid Google+ Button - Bad value publisher for attribute rel
Asked Answered
S

3

6

I recently migrated my website from xhtml transitional to html5. Specifically so that I could make use of valid block level anchor tags. <a><div /></a>.

When running validation I encountered the following error:

Bad value publisher for attribute rel on element link: Keyword publisher is not registered.

But according to this page, that is exactly what I am supposed to do.

https://developers.google.com/+/plugins/badge/#connect

My code:

<link href="https://plus.google.com/xxxxxxxxxxxxxxxx" rel="publisher" />

<a href="https://plus.google.com/xxxxxxxxxxxxxxx?prsrc=3" style="text-decoration:none;">
  <img src="https://ssl.gstatic.com/images/icons/gplus-16.png" alt="" style="border:0;width:16px;height:16px;"/>
</a>

I can't figure out how to implement this in an html5 compliant way. Can anyone help?

Scruple answered 13/4, 2012 at 17:8 Comment(3)
You'd be better off going to StackOverflow, as this is a programming question instead of a Webmaster question.Dimarco
@Dimarco - I actually chose WM on purpose as it seems like something webmasters would be familiar with. If I am wrong I would appreciate a flag for transfer though. I have too little rep to do it here.Scruple
I don't think there's any tidy solution for this. publisher has been dropped and the google code still requires it. I'd ignore the error from (validator.nu?) and keep an eye on the google docs to see if they update the code to use a valid rel value (or switch to something else like data-publisher).Godsend
G
3

1st) Within <head>:

<!DOCTYPE html>
<head>
    <!--head code-->
    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
</head>

2nd) Anywhere within <body>:

<body>
    <!--body code-->
    <div class="g-plusone" data-size="small" data-annotation="none" data-href="https://plus.google.com/u/1/+StackExchange/"></div>
</body>



This code is valid AND "FRIEND'S" with http://validator.w3.org/

You can change https://plus.google.com/u/1/+StackExchange/ for any google+ url you desire (https://plus.google.com/xxxxxxxxxxxxxxxx/)

Documentation

Graecize answered 8/11, 2012 at 4:25 Comment(0)
D
0

Google sends help: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=2539557&topic=2371375&ctx=topic.

You need to add ?rel=author to your <a>s href value and delete that non-conformant <link> tag:

<a href="https://plus.google.com/12345?rel=author">
  <img src="https://ssl.gstatic.com/images/icons/gplus-16.png"/>
</a>
Dulles answered 30/4, 2013 at 23:9 Comment(0)
C
0

Well, you must add two links inside head tag and body tag as follows:

<head>
  <link href='https://plus.google.com/xxxxxxxxxxxxxxxxx' itemprop='publisher'/>
</head>

After that, use the the google+ format in the body. It should be below body tag:

<body>
<a href="https://plus.google.com/xxxxxxxxxxxxxxxxx" rel="publisher" />
.....
.....
.....
</body>

here's the screenshot. Oops! sorry, I need 10 reputation to load Image in this page ... LOL From the two formats, we will be validated by Structured Data of Google Webmaster and validator.w3.org. As you know that in microdata schema uses publisher as one of the itemprop, therefore, in body tag or in html tag should be like this:

<body itemscope="" itemtype="http://schema.org/Blog">

*) that's it when your site type is a BLOG.

(Love this forum) tina-andrew-blog NB: I found this: https://productforums.google.com/d/msg/webmasters/lciIK8HdJXE/kcv8EipRzzcJ But, I do with the code above, It works well :(

Convalescence answered 12/3, 2014 at 15:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.