homepage Welcome to WebmasterWorld Guest from 54.237.98.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Google / Google SEO News and Discussion
Forum Library, Charter, Moderators: Robert Charlton & aakk9999 & brotherhood of lan & goodroi

Google SEO News and Discussion Forum

    
Canonical link tag automation
AlexB77

5+ Year Member



 
Msg#: 4362914 posted 4:28 pm on Sep 15, 2011 (gmt 0)

Hey all,

Can anyone help with some sort of a php script or piece of code to automate
<link rel="canonical" href="http://www.mysite.com/dir_one/index.html">
generation on the standard html page.

any help is much appreciated.

 

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4362914 posted 4:43 pm on Sep 15, 2011 (gmt 0)

Depending on what you mean by "standard HTML", it might be a bit tough to automate. Unless you are using a CMS, there's nowhere to grab the canonical URL itself. If you are using a common CMS, most of them already have canonical link plug-ins available.

AlexB77

5+ Year Member



 
Msg#: 4362914 posted 5:21 pm on Sep 15, 2011 (gmt 0)

Thanks Tedster,

so the only real way is to basically put link on each page manually?

I have one more question

does that mean if a website is placing this link under the templates editable region (note: not including within editable region), does that mean that this site is actually using CMS?

<!-- InstanceEndEditable -->
<link rel="canonical" href="http://www.mysite.com/dir_one/index.html">

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4362914 posted 7:01 pm on Sep 15, 2011 (gmt 0)

Are you talking about Dreamweaver? I haven't used it since the canonical link was introduced. But, from what I recall, that does sound like someone is manually adding the actual canonical URL to every page.

AlexB77

5+ Year Member



 
Msg#: 4362914 posted 7:33 pm on Sep 15, 2011 (gmt 0)

It is Dreamweaver and Yes it does not, but then what we are left with?

There may be some sort of php snippet that can basically strip or simply copy the URL before any "?" mark or something?

tedster

WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4362914 posted 11:07 pm on Sep 15, 2011 (gmt 0)

But where would the url be sourced from? You don't want a canonical link to be generated on the fly - it should be actually written into the page.

If you're concerned about stripping any bad query strings, I'd do that in your own .htaccess file, not with the canonical link tag that depends on the search engines getting it right.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Google / Google SEO News and Discussion
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved