Magento, SEO

Link Rel Author & Publisher Tags in Magento via local.xml

The are a variety of reasons for including the rel=”author” and rel=”publisher” link tags (occasionally referred to as meta tags) in the section of your sites markup and this post will detail how to add them to your Magento theme via a local.xml file update.

The primary reason is to help Google associate your Magento site and any content on it, with a particular author’s and / or publisher’s Google+ account. This has a few benefits, firstly it may, or may not contribute to the rumoured ‘Google Authorship Algorithm’. Secondly, it should help Google associate an author and / or publisher of content and show their information and image in the Google Web Search and Google News results.

This can benefit you two fold, firstly by a more appealing search result that tends to increase click through rates (CTR) in tests that I have done and secondly pull in extra information into the result.

For more information regarding Google authorship, see the following link: https://support.google.com/webmasters/answer/1408986?hl=en&ref_topic=6003069

Add link rel=”author” tag in Magento

The xml code below can be inserted via the layout.xml to appear sitewide as detailed further in this post, or via Magento’s admin as a page layout update on a CMS page, category etc. You must replace ‘+youpagegooglepluspageurlhere’ with your own Google plus page’s unique url.


<action method="addLinkRel">
    <rel>author</rel>
    <href>https://plus.google.com/+youpagegooglepluspageurlhere/</href>
</action>

Add link rel=”publisher” tag in Magento

Similar to the code above, the xml below will add the markup to for the link rel=”publisher” tag to your entire site if specified in a default, head reference in your layout.xml or on specific cms pages via layout updates in your Magento sites admin. Replace ‘+youpagegoogleplusbusinesspageurlhere’ with your business or local business Google+ page url associated with the site.


<action method="addLinkRel">
    <rel>publisher</rel>
    <href>https://plus.google.com/+youpagegoogleplusbusinesspageurlhere/</href>
</action>

Magento layout.xml update for rel=”author” & rel=”publisher” tags

The two snippets of xml above can be placed in your Magento theme’s layout.xml file contained within the default, head reference as shown below. This will implement both tags sitewide in the section of your Magento sites markup.


<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addLinkRel">
                <rel>author</rel>
                <href>https://plus.google.com/+youpagegooglepluspageurlhere/</href>
            </action>
            <action method="addLinkRel">
                <rel>publisher</rel>
                <href>https://plus.google.com/+youpagegoogleplusbusinesspageurlhere/</href>
            </action>
        </reference>
    </default>
</layout>

Front End Rendered Tags

Below are the author and publisher link tags as they will render in the markup on the front end of your site, to see if they are appearing correctly, view the page source in your browser.


<link rel="author" href="https://plus.google.com/+youpagegooglepluspageurlhere/" />
<link rel="publisher" href="https://plus.google.com/+youpagegoogleplusbusinesspageurlhere/" />

A quick pointer that you must take note of for displaying authorship information in search results, is that you must have a profile picture of your self without any filters applied to it on the account linked via the re=”author”. The rel=”publisher” can be a logo etc. but I am yet to see these appear in any SERP’s.

Finally you can test the implementation of the authorship markup using Google’s tool here: http://www.google.com/webmasters/tools/richsnippets.