Hi,
below is the code i use for all my sites for canonical issues and so far it's worked ok
<base href="[[!++site_url]]" />
<link rel="canonical" href="[[++site_url]][[*id:isnot=`[[++site_start]]`:then=`[[~[[*id]]]]`]]" />
However, on my latest site it is refusing to be saved by Modx.
All sites are on the same server and running the same version of Modx Revo 2.5.7
By trial and error I deduced it was the last bit that was causing the problem
And in particular the
So I rewrote it as
<link rel="canonical" href="[[++site_url]][[*id:isnot=`[[++site_start]]`:then=`[[*id]]`]]" />
Just to see what would happen. It worked ok except I got the id number in the url instead of the alias.
So I changed it to "alias"
<link rel="canonical" href="[[++site_url]][[*id:isnot=`[[++site_start]]`:then=`[[*alias]]`]]" />
That seems to have worked but not sure if it's correct code syntax without the tilde and the extra brackets.
Plus I still don't know why the original code won't save.
Anyone got any ideas?
Thanks