Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-07-30 14:07:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Duplicate meta descriptions

Although this is caused by oui_cookie, it is nevertheless a problem which is beyond the plugin’s scope.

All my pages currently have a duplicate meta description error in … cough cough … google webmaster tools. This is because all pages have two urls.

  1. <txp:permlink />
  2. <txp:permlink />?accept_cookies=yes

I have added a rel="nofollow" to the accept_cookies link and <!--googleoff: all--> before, and <!--googleon: all--> after the cookie warning, but google seems to be ignoring both.

The easy way is to ignore the error and not care about it. Can anyone recommend a hard way?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#2 2018-07-30 14:35:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

Posting in this forum helps soooo much…

I hope that this will work. No it doesn’t. It only returns the noindex meta.

<txp:variable name="a_c">http://www.neme.org<txp:page_url />?accept_cookes</txp:variable>
<txp:if_variable name="a_c" value='http://www.neme.org<txp:page_url />?accept_cookes'>
<meta name="Robots" content="noindex,follow" />
<txp:else />
<txp:if_section name="contact,newsletter">
<meta name="Robots" content="noindex,follow" />
<txp:else />
<meta name="author" content="NeMe and contributors" />
<meta name="Robots" content="index,follow" />
<meta name="revisit-after" content="10 days" />
</txp:if_section>
</txp:if_variable>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2018-07-30 16:07:26

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

Re: Duplicate meta descriptions

I think we discovered before that the <!--googleoff: all--> before, and <!--googleon: all--> only relates to google-powered site-internal search widgets so it won’t affect search results.

Two ideas:

  1. Make sure your rel="canonical" tag only produces the link without the accept-cookies query – see consolidate duplicate urls at google. That should cause google to log that address as the preferred URL.
  2. Categorize your URL parameters in Google Webmaster tools so that URLs with the ?accept-cookies query are not logged – see Categorize parameters with the URL Parameters tool, also at google.

One or both of those should help…


TXP Builders – finely-crafted code, design and txp

Offline

#4 2018-07-30 16:15:41

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

No 1. Point is absolutely right! But I have no idea how to omit the cookie acceptance url from it…

This is what I have now: <link rel="canonical" href="http://www.neme.org<txp:page_url />" />


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2018-07-30 21:53:18

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

Re: Duplicate meta descriptions

I tend to construct my canonical tags manually, but you could perhaps use smd_wrap to split the page url at the ? character and keep just the first part of the string, e.g.:

<link rel="canonical" href="http://www.neme.org<txp:smd_wrap transform="split|?||first"><txp:page_url /></txp:smd_wrap>" />

Worth a try perhaps?

Note that removes all query strings, not just the accept_cookies one but that may be advisable anyhow.


TXP Builders – finely-crafted code, design and txp

Offline

#6 2018-07-31 06:25:42

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

Thanks so much Julian but I’m not quite there yet…

I was wondering, is there a way to get the URL-only title from the db?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2018-07-31 06:47:56

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

Almost got it!

<txp:if_search>
<link rel="canonical" href="http://www.neme.org<txp:page_url />" />
<txp:else />
<txp:if_article_list>
<link rel="canonical" href="http://www.neme.org/<txp:section />/" />
<txp:else />
<link rel="canonical" href="http://www.neme.org/<txp:section />/<txp:custom_field name="url_title" />" />
</txp:if_article_list>
</txp:if_search>

Now, all I need is a way to detect the home page


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#8 2018-07-31 07:03:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

Here is the final one with txp tags should anybody want to use it:

<txp:if_search>
<link rel="canonical" href="<txp:site_url /><txp:page_url />" />
<txp:else />
<txp:if_article_list>
<txp:if_section name="">
<link rel="canonical" href="<txp:site_url />" />
<txp:else />
<link rel="canonical" href="<txp:site_url /><txp:section />/" />
</txp:if_section>
<txp:else />
<link rel="canonical" href="<txp:site_url /><txp:section />/<txp:custom_field name="url_title" />" />
</txp:if_article_list>
</txp:if_search>

ps.. I think that I discovered another feature: <txp:custom_field name="url_title" />:)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2018-07-31 07:37:24

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

Re: Duplicate meta descriptions

colak wrote #313180:

Is there a way to get the URL-only title from the db?

There’s txp:permlink which should give you the entire link to the individual article without url queries, and there’s txp:article_url_title which will give you just the article’s url stub.

colak wrote #313182:

Here is the final one with txp tags…

That’s more or less how I do it too.

Because I often work on a local site or put up a test site on a client’s subdomain or on my own domain, I’ve gone over to defining a variable called public_domain that holds the intended public domain. I use that to construct the canonical url so that in the event that google should find it on my test or staging domain, it logs what should be the bona-fide url.
I also compare that variable against the site_url to send meta noindex tags and turn off analytics etc.


TXP Builders – finely-crafted code, design and txp

Offline

#10 2018-07-31 07:50:02

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Duplicate meta descriptions

Thanks again Julian… How could I forget that one? Here is the structure again.

<txp:if_search>
<link rel="canonical" href="<txp:site_url /><txp:page_url />" />
<txp:else />
<txp:if_article_list>
<txp:if_section name="">
<link rel="canonical" href="<txp:site_url />" />
<txp:else />
<link rel="canonical" href="<txp:site_url /><txp:section />/" />
</txp:if_section>
<txp:else />
<link rel="canonical" href="<txp:permlink />" />
</txp:if_article_list>
</txp:if_search>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#11 2018-08-01 08:50:16

etc
Developer
Registered: 2010-11-11
Posts: 5,057
Website GitHub

Re: Duplicate meta descriptions

Would adding type="canonical" to <txp:page_url /> possible types be useful?

Offline

#12 2018-08-01 12:28:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,081
Website

Re: Duplicate meta descriptions

etc wrote #313191:

Would adding type="canonical" to <txp:page_url /> possible types be useful?

What would it bring to the table?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB