I think I understand that the point of a canonical link is to show search engines the one true page URL.
With this in mind I have written the following code into my ‘head’ snippet:
<link rel="canonical" href="<?= $site->canonical() ?><?= $page->NAME() ?>">
The site canonical is:
https://www.xyz.com/
… telling the search engine that I want the page to be https and include the www
And then I want to be able to automatically add to the end of this the page NAME, for example:
business-name-case-study
or
'about'
etc.
How would I do this?
Or if I set up my .htaccess file to take visitors to the URL starting with https://www then is the above necessary? Could I then simply use:
<link rel="canonical" href="<?= $page->url() ?>">
because this will include the https and www