Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-08-30 11:38:31

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Double content

Hi folks.

I’ve got some double indexed Urls on a website (http://my-domain.com/article and http://my-domain.com/article/). Which best practice to avoid it?
Note: I’m using smd_short_url plugin.

Thanks for your ideas.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2012-08-30 12:42:53

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Double content

rel=‘canonical’ for instance. Place it to the head and use your basic navigation tags such as the permlink and the section to generate appropriate URLs for each page. For an individual article is as simple as:

<link rel="canonical" href="<txp:permlink />" />

Offline

#3 2012-08-30 14:57:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Double content

Pat64 wrote:

Note: I’m using smd_short_url plugin.

That’s got a tag to generate canonical links like Gocom posted (well, sort of):

<txp:if_individual_article>
   <txp:smd_canonical />
</txp:if_individual_article>

Except the tag uses rev= instead of rel= because someone told me that was right. I’m not so sure now. Either way, if you don’t want that and wish to roll your own, you can specify the type="url" attribute and it’ll just return you the link to the article. Except you might as well use <txp:permlink> for that.

*shrug* plugin not well thought through :-)

Last edited by Bloke (2012-08-30 15:00:25)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2012-08-30 15:33:09

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Double content

Bloke wrote:

Except the tag uses rev= instead of rel= because someone told me that was right.

When in doubt open up MDN. It’s obsolete in HTML5 and even when not, it doesn’t do anything in this scenario.

Offline

#5 2012-08-30 17:18:08

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: Double content

Hi Guys :)

Tks for your answers, mate.

I’m still using canonical links. Sorry, my fault: that’s not a duplicate Urls problem… just a meta description one… with duplicate Urls, too!

Google Webmaster Tools says:

“You’ve got a double meta description on some pages:

  • http://my-domain.com/section/
  • http://my-domain.com/section/?pg=2
  • http://my-domain.com/section/?pg=3
  • http://my-domain.com/section

So, I can personalize each page generated with pagination – even if TXP has a problem with the first page – but what can I do with my section?

Here is my doctype content:

<txp:if_individual_article>
	<link rel="canonical" href="<txp:permlink />"><txp:else />
	<link rel="canonical" href="http://my-domain.com<txp:page_url />"></txp:if_individual_article>

Is there a difference with the ending slash between the two tags <txp:permlink /> and <txp:page_url /> ?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB