Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-12-17 06:39:21

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,258
Website

[SOLVED] canonical urls in search results bug?

I know that it is questionable if search results should have canonical urls but I have this meta tag for them:

<txp:if_search>
<link rel="canonical" href="<txp:site_url trim="/" /><txp:page_url />" />
</txp:if_search>

the parsed result of which is

<link rel="canonical" href="http://www.site.tld/?m=any&amp;q=query" />

Copying and pasting the url returns a 404 because of the &amp;. I think that the result should be:

<link rel="canonical" href="http://www.site.tld/?m=any&q=query" />

Would it validate though?
I also tried

<link rel="canonical" href="<txp:site_url trim="/" context /><txp:page_url />" />

which again returned the same url


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#2 2019-12-17 15:13:04

etc
Developer
Registered: 2010-11-11
Posts: 3,842
Website

Re: [SOLVED] canonical urls in search results bug?

colak wrote #320578:

I think that the result should be:

<link rel="canonical" href="http://www.site.tld/?m=any&q=query" />...

Would it validate though?

I don’t think so. But it might be possible to get it with escape="", not tested.

Offline

#3 2019-12-17 15:27:43

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,258
Website

Re: [SOLVED] canonical urls in search results bug?

Interesting

<link rel="canonical" href="<txp:site_url trim="/" /><txp:page_url escape="" />" />

validates just fine! I guess that the validator understands the content!


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github | Covid-19; a resource
I do my best editing after I click on the submit button.

Offline

#4 2019-12-17 15:37:20

etc
Developer
Registered: 2010-11-11
Posts: 3,842
Website

Re: [SOLVED] canonical urls in search results bug?

colak wrote #320588:

validates just fine!

Fine then :-)

Offline

Board footer

Powered by FluxBB