Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2018-06-20 14:31:19

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: SEO optimisations of blog article list

textpattern 4.7.0 can do this:

<link rel="canonical" href="<txp:site_url /><txp:page_url type="request_uri" />"> 

or

<link rel="canonical" href="<txp:link_to_home /><txp:page_url type="request_uri" />">

But there is a problem – double slash:

<link rel="canonical" href="https://www.example.com//blog/">
<link rel="canonical" href="https://www.example.com//blog/?pg=2">
<link rel="canonical" href="https://www.example.com//blog/?pg=3">

….mple.com // blog….

It can be fixed?


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#14 2018-06-20 15:04:07

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,137
GitHub

Re: SEO optimisations of blog article list

singaz wrote #312648:

But there is a problem – double slash:

[…]

It can be fixed?

Does your site URL have a trailing slash? If so, remove it – and the problem is fixed.

Offline

#15 2018-06-20 16:08:02

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: SEO optimisations of blog article list

No, my site URL not have a trailing slash.

The <txp:site_url /> tag returns slash at the trailing of the URL

https://www.example.com/

The <txp:page_url /> tag returns slash at the beginning of the URL and at the trailing of the URL

/section/

tag <txp:site_url /> + tag <txp:site_url /> get two slashes

https://www.example.com//section/

I do not know how to remove an extra slash

There is no slash:

There is a slash here:

Last edited by singaz (2018-06-20 16:21:59)


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#16 2018-06-20 16:31:17

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

Re: SEO optimisations of blog article list

Alternative?

<link rel="canonical" href="http://www.yoursite.tld<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

#17 2018-06-20 20:36:05

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: SEO optimisations of blog article list

colak wrote #312655:

Alternative?

<link rel="canonical" href="http://www.yoursite.tld<txp:page_url />" />...

Good decision.

I will do so.

Thank you!


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

#18 2018-06-20 21:57:48

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

Re: SEO optimisations of blog article list

Another approach that I sometimes use is to set the public_domain without the trailing slash in a variable (e.g. using adi_variables or oui_prefs). That can be useful when working on a test or staging domain that’s not the final public domain, for example:

  • Set the canonical url to always use the desired public_domain rather than your test or staging domain.
<link rel="canonical" href="http://<txp:variable name="public_domain" /><txp:page_url />" >
  • Use it in conjunction with ied_if_domain to send meta noindex tags or to prevent google analytics from loading when not on the public domain.

TXP Builders – finely-crafted code, design and txp

Offline

#19 2018-06-22 19:48:26

singaz
Member
Registered: 2017-03-12
Posts: 150

Re: SEO optimisations of blog article list

Hi jakob

An interesting solution.

Thank you


Sorry my horror English. I’m learning textpattern, I’m learning English

Offline

Board footer

Powered by FluxBB