Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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.
- <txp:permlink />
- <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
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
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:
- 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. - 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
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
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
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
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
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
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
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
Re: Duplicate meta descriptions
Would adding type="canonical"
to <txp:page_url />
possible types be useful?
Offline
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