Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-05-07 09:11:02

mmelon
Member
Registered: 2006-03-02
Posts: 95

[howto] query strings and duplicate content

Hi,

I know some people have problems with query strings being indexed in search engines. I myself wonder if the various ways to hit an article or an article list, can upset google.

If you’ve never tried it, here’s some of the txp specific url keywords that can return a list of articles

here

Anyway, does it not make sense to include the following in the head, and simply prevent any urls with query strings from being indexed?

<txp:php>
global $pretext;
if($pretext['qs']) {
	$robots = '<meta name="robots" content="noindex,nofollow"/>';
	} else {
	$robots = '<meta name="robots" content="index,follow,noodp,noydir"/>';
}
echo $robots;
</txp:php>

Seems quite severe but I can’t think of a single example (on an average content/brochure site) when you would need a url with a query string indexing.

What do we all think?

Mike

Last edited by mmelon (2012-05-07 09:14:41)

Offline

#2 2012-05-07 11:29:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: [howto] query strings and duplicate content

Hi Mike, wouldn’t specifying a canonical URL do the same?

Offline

#3 2012-05-07 12:30:30

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

Re: [howto] query strings and duplicate content

As far as pretext goes, page_url can return any value it holds.

<txp:variable name="qs" value='<txp:page_url type="qs" />' />

<txp:if_variable name="qs" value="">
	<meta name="robots" content="index, follow, noodp, noydir" />
<txp:else />
	<meta name="robots" content="noindex, nofollow" />
</txp:if_variable>

Offline

#4 2012-05-07 12:33:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,599
Website

Re: [howto] query strings and duplicate content

I do the same as Els and specify a preferred canonical URL. I believe you can also tell google in google webmaster tools what the queries denote in an url (of course that’s just google).

Seems quite severe but I can’t think of a single example (on an average content/brochure site) when you would need a url with a query string indexing.

Possibly on sites where long lists of articles are paged.

FWIW, you can also do your snippet without php…

EDIT: jukka was faster…


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB