613-231-6308
Toggle Menu
Well, Google Plus is not intuitive at all. And the instructions are disconnected. Each step maybe described well, but the whole process - go and figure it out on your own.
So here is what we did to enable Google "authorship" feature so that our blog posts appear on Google search results like this:
<a rel="author" href="/<your G+ profile link>">John Smith</a>
For K2 articles; if you selected the option to 'show Author', it already creates the following:
<a rel="author" href="/<link to K2 user page>">John Smith</a>
Find under <!-- Item Author --> the following code
echo $this->item->author->link;
and replace it with (save copies!)
echo $this->item->author->profile->url;
http://duben.org/joomla-english/sd-google-authorship-plugin-for-joomla or this: http://www.deconf.com/en/projects/how-to-set-up-google-authorship-markup-with-rel=author-in-joomla/
templates/<your template>/html/com_content/article/default.php (if not found, copy from components/com_content/views/article/tmpl/default.php)
Find where it generates the author text (usually with a class called createdby or create_by), and replace it with the following:
<?php
//name of K2 user table
$query = 'SELECT url FROM #__k2_users WHERE userID=' . $this->article->created_by;
$db =& JFactory::getDBO();
$db->setQuery($query);
$authorlink = $db->loadResult();
?>
This gives the variable $authorlink your Google Profile URL that you saved in K2 in the steps above.
<a rel="author" href="/<?php echo $authorlink; ?>"><span class="createby">
<?php some code from Joomla that shows the author name ?></a>
</span></a>
That should make authorship works on Joomla default articles too.
Hope this works for you!
It takes a few days for Google to reindex your pages and start showing your "authorship".