Welcome Guest, Not a member yet? Register   Sign In
Canonical links & CodeIgniter
#1

[eluser]Phil Sturgeon[/eluser]
I have posted a new article about Canonical links in CodeIgniter which some of you guys may be interested in.

Canonical links & CodeIgniter

If you have any feedback please leave it here instead of trying to get past the captcha, that thing is busted to hell.
#2

[eluser]Dam1an[/eluser]
Good post... its something I've never yet thought about, but really should
I also think the second method will be the best Smile
#3

[eluser]xwero[/eluser]
if you are worried about people not using the link you want the search engines to catch why not use redirects?

I know google likes urls with .html at the end more than others but IMO it's a trick that will go stale and it's annoying for the visitors, .html means nothing to them.
I think the only time an extension suffix has a function is when you can get the content in different formats like http://example.com/news.html - http://example.com/news.rss - http://example.com/news.json and http://example.com/news/Article-name.html - http://example.com/news/Article-name.pdf - http://example.com/news/Article-name.txt .

Adding the date to the article should only happen when two or more articles share the same name and if it was up to me i would add it to the article slug to have a unique identifier. http://example.com/news/Article-name and http://example.com/news/Article-name-01-01-2009.
#4

[eluser]Phil Sturgeon[/eluser]
Good point. I was not using .html for SEO purposes I think I had it included in PyroCMS for some crazy username trick a client required me to do, and never took it back out afterwards. That wasn't really the point of the article.

I have been talking to a few people and I am no longer sure if canonical links are used by Analyitic anyway.

Also the post contains the wrong code for canonical links. It should be:

Code:
<link rel="canonical" href="">

Oops...
#5

[eluser]Phil Sturgeon[/eluser]
Perhaps just use method 1 then if Google Analytic doesn't care?
#6

[eluser]Phil Sturgeon[/eluser]
A solution!

Two options (I like options).

#1 - Erik Vold has some JavaScript to get this going properly as my post above suggested.

#2 - Cut out the middleman. Use the two values from Method #2 in my post, and set the one for Google bots as canonical and pass the one for Analytic straight to _gat.

Example:

Code:
<link rel="canonical" href="<?=site_url( $this->uri->uri_string() );?>" />

Code:
<scr1pt type="text/javascript">
var pageTracker = _gat._getTracker("UA-XXXXXXX-YY");
pageTracker._trackPageview("&lt;?=base_url().$this->uri->ruri_string();?&gt;");
}
catch(err){}
</scr1pt>
#7

[eluser]xwero[/eluser]
Damn i really need to wake up, i missed the nice title Smile

On the google webmaster central blog i found this article and it reads
Quote:It's a hint that we honor strongly. We'll take your preference into account, in conjunction with other signals, when calculating the most relevant page to display in search results.
It's pretty vague if it really helps to improve your pagerank or not?
#8

[eluser]Phil Sturgeon[/eluser]
I work with several guys who seem to strongly believe that it does. All I figure is - it probably wont hurt.

With the code above (shown as basic ideas and not actual implementation, yuck) I can set these up and have much cleaner looking analytic stats and help cut down on duplicated Google search results.

I'll amend my article later, with full acknowledgement of my original idiocy.
#9

[eluser]Phil Sturgeon[/eluser]
There we go, updated post with a new recommendation and have included the code into PyroCMS to test it. Works fine. :-)




Theme © iAndrew 2016 - Forum software by © MyBB