Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This has been implemented as a new feature in D8 core: #1184472: Adding rel="author" to "Submitted by" link
How do we do it in D7?
Comments
Comment #1
klonos...here's a snippet by bleen18 that's supposed to do the trick:
You'll need to place the code in your theme's template.tpl file and change the
mytheme
part of the functions to the actual name of your theme.Comment #2
klonosI have tried adjusting and adding the code to core's Garland theme, but I can't get it to work :?
Comment #3
modctek CreditAttribution: modctek commentedI tried this code as well, but it changed my byline to "Anonymous". Might be interference from the theme itself...haven't looked at the code to determine. This is the "Titan" theme.
Comment #4
mntash CreditAttribution: mntash commentedI am very interested in getting this to work.
I had created a forum post here: http://drupal.org/node/1515288 trying to figure out how to do it.
I don't know if this should be added to core, because rel=author is only supported by google, right?
But anyways, I would love to know how to add a rel=author link for each node which points to the user's profile. And from there, would need a rel=me pointing to their social networking profile, such as G+
Comment #5
klonosWell, I believe that everyone agrees that Google is very important when it comes to SEO, and this problem needs to be addressed. I don't know if core is the right place to do it (it was done in core for D8 though - see issue summary above) or if it should be handled in contrib. I simply need to solve this.
BTW, I realize that the issue at hand is not UI related, but nevertheless I'd like to point to: #1505456: Add a "Backports" or "Drupal update" module to Drupal 7 core so that UI changes from Drupal 8 can be backported
Comment #6
mntash CreditAttribution: mntash commentedThanks for the reply.
Yes, Google is the most important search engine right now, and that's why I am looking for a solution for rel=me and rel=author. I guess my concern is more of a generic "what if Bing comes out with their own markup, or Google becomes less relevant in the future?"
But no matter, because right now I need rel=me and rel=author. I read on another site that wordpress has it already or will very soon. I will keep an eye on the thread you linked to regarding backports. I just need this to work, soon.
Comment #7
mntash CreditAttribution: mntash commentedI'm pretty much over my head with this one. I posted a request for help here: http://drupal.org/node/1515288 but not replies yet.
What I thought I could do is to add a profile text field where users could add the URL to their Google+ page in their user profile in Drupal. Then I could somehow insert a rel=me link directly into the header of the node. That should bypass the rel=author step.
Or, use the full 3 step process: rel=author in the node, rel=me in the user profile/author page, and the reciprocal link from G+ profile to user profile/author page in Drupal.
There's no way to add an extra link in a node using Meta Tag module? Or maybe add a field in structure/content type?
Comment #8
mntash CreditAttribution: mntash commentedbump
Comment #9
jamix CreditAttribution: jamix commentedtemplate_preprocess_username() in D7's core overwrites $variables['link_attributes'] passed to it. We can add the extra rel attribute ourselves based on a flag set in mytheme_preprocess_node().
This works in Drupal 7.10 (I should upgrade, I know, I know):
As usual, replace
mytheme
with your theme name, put the code in your template.php and clear cache.Comment #10
mntash CreditAttribution: mntash commentedThanks. So this links the node to the node author's page on the website.. and the author's page should then be linked to the author's G+ or other social account?
Comment #11
doru CreditAttribution: doru commentedI searched everywhere for the above for Drupal 6. I haven't found it.
I am using Drupal 6 with a Genesis child theme. I am not versed enough to modify this for D6.
Cheers,
Comment #12
remkovdz CreditAttribution: remkovdz commentedIs there already a good solution for this?
Comment #13
Pasquallefor D6: #1824368: How to add rel="author" to the "Submitted by" link?
The Metatag module has rel=author option:
https://drupal.org/project/metatag
https://groups.drupal.org/node/229413