SMF Canonical Tag

Started by vmgamer, February 16, 2009, 11:51:14 AM

Previous topic - Next topic

vmgamer

Link to the mod

SMF Canonical Tag (1.2) for SMF 1.1.x and 2.0 By Fuad & Nevacloud ESG


  This mod will adds a canonical tag for topics and boards.  Helps search engines indexing your important pages. Preventing duplicate contents, and good for SEO :)

About canonical tag:
http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html

phpMyTony

Any screenshots of the tag in use?

vagrant

Nice mod. Should prove helpful

Quote from: CSS on February 16, 2009, 11:52:15 AM
Any screenshots of the tag in use?

How does one do a screenshot of a header meta tag?

phpMyTony

Ohh sorry! I was looking at two different mods, this one and an avatar one. Sorry lol.

Özgür

Really nice mod. Thank you @vmgamer.
So Long

karlbenson

Note, the canonical tag has been added to the development version of SMF 2.0, so it should be included in SMF 2.0 RC2.
(although it doesn't add it in exactly the same way as this mod).

ccraciun

What is your opinion about using this mod to existing forums? It's obvious that for new installations this would help much, but i don't know what would be the impact for existing indexed content.
My forum is quite new, it's 2 months old and i have ~ 300 pages indexed by google (most probably with duplicate links).

So, what this mod actually do?  :-[
I noticed that in your forum, the address of a topic looks like this: http://simszone.org/absen-box/absen-disini/
and in source it has
<link rel="canonical" href="http://simszone.org/absen-box/absen-disini/" />
This means that the only link that will get PR credit, will be the one specified in the canonical tag? The other ones (like: URL/index.php?topic=x.0; URL/index.php/topic,x.0.html; URL/index.php?topic=x) will still be accessible but will pass PR only to SEF URL?

What mod did you used to have that kind of link (like URL/board/topic style)?

In your opinion it would be recommended for existing forums to apply SEO4SMF mod + canonical tag mod, and point as canonical link the SEF URL? I intended to use SEF URLs but beeing affraid to add one more link to my pages i gave up; now i shouldn't be affraid anymore regarding splitting PR between all the links?

Thanks and i apologies about my long post, but i tried to clarify things; i don't know much about seo and i guess other users will find an answer to this, helpful.
Many thanks.

karlbenson

Basically for various links which point to almost identical pages, it tells google which is the real one, and all PR juice is moved towards the real one.


Mick.

After applying this mod,..... will i have "404 not found" since the links changed?

vmgamer

No, that won't

This mod only adds a rel="canonical" tag

Mick.

Quote from: vmgamer on March 07, 2009, 08:12:33 AM
No, that won't

This mod only adds a rel="canonical" tag

Ah ok.   Thanx.    I looked at your website and read the previous post and it confused me as i think both of yous use the pretty url's mod.

Low

VMGAMER,

Are you saying your mod will tell Google.. example.com/one/print-page should pass the love to.. example.com/one ??

If so, you're a frikking GOD lol.

See, Google has been indexing my example.com/one/wap2 pages instead of the original and I'm hoping your mod will make Google index the original/MAIN pages.

Please let me know ASAP and thanks again.

Low

Özgür

Quote from: Low on April 07, 2009, 10:03:06 PM
VMGAMER,

Are you saying your mod will tell Google.. example.com/one/print-page should pass the love to.. example.com/one ??

If so, you're a frikking GOD lol.

See, Google has been indexing my example.com/one/wap2 pages instead of the original and I'm hoping your mod will make Google index the original/MAIN pages.

Please let me know ASAP and thanks again.

Low
I agree.
So Long

karlbenson

Low. Yes.

P.S This is a default feature in RC2 (when that is released)

Mr. Jinx

I would like to also add a canonical tag to the index.php page.
My site is indexed in google with http://www.site.com/forum & http://www.site.com/forum/index.php
Both have different page ranks.
How can I adjust the code so it detects the boardindex and add a canoncical tag?

Original code:

if (!empty($context['current_topic']))
                echo '
        <link rel="canonical" href="', $scripturl, '?topic=', $context['current_topic'] . (!empty($context['start']) ? '.' . $context['start'] : '.0') . '" />';
        elseif (!empty($context['current_board']))
                echo '
        <link rel="canonical" href="', $scripturl, '?board=', $context['current_board'] . (!empty($context['start']) ? '.' . $context['start'] : '.0') . '" />';

Low

Oh what a shame, I just noticed on the demo link that the PRINT-pages have no tag :(

Seriously, Google loves to index everything except the original/main page so....  it's back to the drawing board for me.

Low

sixthofmay

FYI:
I installed this and while looking through the view source of my topics, I noticed all the topics have the tag. Not just links like prev/next urls. Reading the google blog page [nofollow] about the tag, they don't mention if it's ok to have a self-referential tag.

After some searching, I found the answer, and yes it's ok to have the tag on the main page as well:
http://extranet.mivamerchant.com/forums/showthread.php?p=95684 [nofollow]

sixthofmay

Quote from: Mr. Jinx on April 12, 2009, 06:11:38 AM
I would like to also add a canonical tag to the index.php page.
My site is indexed in google with http://www.site.com/forum [nofollow] & http://www.site.com/forum/index.php [nofollow]
Both have different page ranks.
How can I adjust the code so it detects the boardindex and add a canoncical tag?

Original code:

if (!empty($context['current_topic']))
                echo '
        <link rel="canonical" href="', $scripturl, '?topic=', $context['current_topic'] . (!empty($context['start']) ? '.' . $context['start'] : '.0') . '" />';
        elseif (!empty($context['current_board']))
                echo '
        <link rel="canonical" href="', $scripturl, '?board=', $context['current_board'] . (!empty($context['start']) ? '.' . $context['start'] : '.0') . '" />';


I hard coded mine like this (added on the line after after the Canonical Tag code):

elseif ($context['page_title'] == 'Some Bands I Like - Index')
echo '
<link rel="canonical" href=http://www.somebandsilike.com/ />';


Obviously change the page title to match your index page's title, and the href to your index page's url.

sixthofmay

Quote from: Low on April 22, 2009, 10:13:33 AM
Oh what a shame, I just noticed on the demo link that the PRINT-pages have no tag :(

Seriously, Google loves to index everything except the original/main page so....  it's back to the drawing board for me.

Low

You probably don't want a canonical tag on print pages as the layout is different from the main pages (would probably hurt your pagerank). Better to use noindex:

In Printpage.template.php, after the <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" /> line add:

<meta name="robots" content="noindex" />


This message indicates you should also have nofollow on the Print button link as well:
http://www.simplemachines.org/community/index.php?topic=125867.msg1928009#msg1928009

..but wiki article says nofollow may still be followed and indexed:
http://en.wikipedia.org/wiki/Nofollow [nofollow]

And this page will make your head spin:
http://www.iterasi.net/openviewer.aspx?sqrlitid=aa2jetsqhuemfdor8y9zeq [nofollow]

And after studying the code to figure out how to add nofollow to the print button, I decided not to bother (I gave up trying to figure it out...).

If anyone wants to try, around lines 170 in Display.template.php builds the button arrays, and the mod code would probably be added to the template_button_strip function in index.template.php. The part I couldn't figure out is what variable to test for 'print' context. This is with v1.1.8.

londonhogfan

would it be possible to add an option to pick the cononical tag for a topic?  I'm using SSI to display posts on other pages and I want the pages pulling from the forum to be the indexed pages.  Something like the attached image is what i'm talking about. Of course it could only be available for admins.

Advertisement: