Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vmgamer on February 16, 2009, 11:51:14 AM

Title: SMF Canonical Tag
Post by: vmgamer on February 16, 2009, 11:51:14 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=1644)

SMF Canonical Tag (1.2) for SMF 1.1.x and 2.0 By Fuad (https://fuad.me/) & Nevacloud (https://nevacloud.com/)
  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
Title: Re: SMF Canonical Tag
Post by: phpMyTony on February 16, 2009, 11:52:15 AM
Any screenshots of the tag in use?
Title: Re: SMF Canonical Tag
Post by: vagrant on February 16, 2009, 03:38:48 PM
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?
Title: Re: SMF Canonical Tag
Post by: phpMyTony on February 16, 2009, 03:48:19 PM
Ohh sorry! I was looking at two different mods, this one and an avatar one. Sorry lol.
Title: Re: SMF Canonical Tag
Post by: Özgür on February 16, 2009, 07:18:37 PM
Really nice mod. Thank you @vmgamer.
Title: Re: SMF Canonical Tag
Post by: karlbenson on February 16, 2009, 07:34:57 PM
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).
Title: Re: SMF Canonical Tag
Post by: ccraciun on February 17, 2009, 12:50:25 PM
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.
Title: Re: SMF Canonical Tag
Post by: karlbenson on February 17, 2009, 06:14:03 PM
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.

Title: Re: SMF Canonical Tag
Post by: Mick. on March 02, 2009, 06:30:38 PM
After applying this mod,..... will i have "404 not found" since the links changed?
Title: Re: SMF Canonical Tag
Post by: vmgamer on March 07, 2009, 08:12:33 AM
No, that won't

This mod only adds a rel="canonical" tag
Title: Re: SMF Canonical Tag
Post by: Mick. on March 07, 2009, 12:50:54 PM
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.
Title: Re: SMF Canonical Tag
Post by: 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
Title: Re: SMF Canonical Tag
Post by: Özgür on April 07, 2009, 10:28:05 PM
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.
Title: Re: SMF Canonical Tag
Post by: karlbenson on April 08, 2009, 01:16:52 PM
Low. Yes.

P.S This is a default feature in RC2 (when that is released)
Title: Re: SMF Canonical Tag
Post by: 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 & 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') . '" />';
Title: Re: SMF Canonical Tag
Post by: 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
Title: Re: SMF Canonical Tag
Post by: sixthofmay on May 02, 2009, 08:46:32 PM
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 (http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html) 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
Title: Re: SMF Canonical Tag
Post by: sixthofmay on May 02, 2009, 09:09:42 PM
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 & 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') . '" />';


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.
Title: Re: SMF Canonical Tag
Post by: sixthofmay on May 02, 2009, 10:40:39 PM
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

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

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.
Title: Re: SMF Canonical Tag
Post by: londonhogfan on June 25, 2009, 10:23:42 PM
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.
Title: Re: SMF Canonical Tag
Post by: Groundhog on August 23, 2009, 05:38:00 PM
Thanks for this mod vmgamer.  :)
Title: Re: SMF Canonical Tag
Post by: checkmater on September 22, 2009, 05:40:50 PM
Appears an error when I tried to install the mod in the Pakage zone.... in the 1.1.10 version.

So I installed it manually and works perfect!!!!

Thank you very much!, Improving SEO!

Greetings.
Title: Re: SMF Canonical Tag
Post by: Mr. Jinx on September 28, 2009, 01:04:01 PM
Quote from: sixthofmay on May 02, 2009, 09:09:42 PM
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.

Thanks! I think code like this should be include in the mod for perfection. Great for SEO!
Title: Re: SMF Canonical Tag
Post by: Özgür on September 28, 2009, 02:06:45 PM
Quote from: Mr. Jinx on September 28, 2009, 01:04:01 PM
Quote from: sixthofmay on May 02, 2009, 09:09:42 PM
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.

Thanks! I think code like this should be include in the mod for perfection. Great for SEO!
Or you can use this

  if (isset($context['current_action']) &&  $context['current_action'] == 'someaction')
      echo '
   <link rel="canonical" href=http://www.somebandsilike.com/ />';

You must change someaction tou what you want. :P
Title: Re: SMF Canonical Tag
Post by: 4LP3RUZ1 on October 19, 2009, 06:35:37 AM
Love this mod, i think it should be included in smf by default :)
Title: Re: SMF Canonical Tag
Post by: InfoStrides on November 22, 2009, 05:48:46 AM
Please, I am curious about these questions:

What is the relationship between this mod and PrettyURLs?
Can they be used together?
Title: Re: SMF Canonical Tag
Post by: InfoStrides on November 22, 2009, 05:50:10 AM
In addition: Is it similar to H tags?
Title: Re: SMF Canonical Tag
Post by: Mr. Jinx on November 22, 2009, 02:55:47 PM
Quote from: 4LP3RUZ1 on October 19, 2009, 06:35:37 AM
Love this mod, i think it should be included in smf by default :)
In SMF 2.0 it is installed by default :)
Title: Re: SMF Canonical Tag
Post by: InfoStrides on November 28, 2009, 05:04:36 PM
I successfully installed the mod and observed the difference in the source code. I am waiting for its action on my site PR.

Thanks to the mod author!
Title: Re: SMF Canonical Tag
Post by: Succubus Evaligan on August 08, 2010, 12:13:25 PM
Canonical is native in SMF 2RC3?
Title: Re: SMF Canonical Tag
Post by: PLAYBOY on April 15, 2011, 09:13:03 PM
Is there any difference between this mod and http://custom.simplemachines.org/mods/index.php?mod=2129 this mod?
I have both of them in my forum... Do i really need both of them?

1.1.13
Title: Re: SMF Canonical Tag
Post by: Arantor on April 15, 2011, 09:17:40 PM
You need this one more than you need the other one.

This one tells search engines to consider pages as duplicates of each other as appropriate (which means you don't get penalised for duplicate content), the other affects meta tags which have no SEO benefit.
Title: Re: SMF Canonical Tag
Post by: PLAYBOY on April 15, 2011, 09:27:50 PM
So i guess i should uninstall "KeyWords Generator (AutoKeywords)"
Title: Re: SMF Canonical Tag
Post by: Arantor on April 15, 2011, 09:34:25 PM
*shrug* It doesn't hurt, it just doesn't help.
Title: Re: SMF Canonical Tag
Post by: coolfx350 on June 06, 2011, 09:24:13 AM
I am getting a lot of duplicated content from google webmaster tools, how do I make this one page instead of 5 pages with the same content?

/android-applications/av-for-incredible/
/android-applications/av-for-incredible/msg12337/
/android-applications/av-for-incredible/msg12426/
/android-applications/av-for-incredible/msg12439/
/android-applications/av-for-incredible/msg12440/
Title: Re: SMF Canonical Tag
Post by: dougiefresh on June 15, 2011, 02:31:55 PM
Thank you for the wonderful mod!  I thought I'd let everybody know that when I updated my forum from 2.0 RC5 to 2.0 Gold, I had to reinstall all my mods.  This mod installed without issues and without emulation.  Hope this info helps someone!
Title: Re: SMF Canonical Tag
Post by: Mr. Jinx on June 21, 2011, 12:59:32 PM
You do not need to install this mod on 2.0 Gold.
Canonical support is included by default now.
Title: Re: SMF Canonical Tag
Post by: dougiefresh on June 22, 2011, 06:26:57 PM
Sweet!  Now if only they would integrate the other 80 mods I have installed  :P

Anyways, thanks for the information!
Title: Re: SMF Canonical Tag
Post by: Xpresskonami on May 28, 2018, 05:59:33 AM
After installing this mod. I still get a lot of duplicate content from Google and it has totally decrease all my index topics from 5000 Index topic to 50. I discovered my urls are

http://url.com/index.php

And

http://url.com

Both URL works on my forum. how can I fix this??