问题
I have to implement canonical tags on a customer website which works with Pimcore CMS. Does somebody has experience with that or can give me some hints?
回答1:
If you want to set this tag globally, or with some simple url regex matching, you can do it straight from the admin panel using Marketing > Tag & Snippet Management.
回答2:
A way could be to set a Document Property and render it in your view. see: https://pimcore.com/docs/4.6.x/Development_Documentation/Tools_and_Features/Properties.html
For PHP Templating Engine you could add this line and set it properly in your Backend.
<link rel="canonical" href="<?= $this->document->getProperty('canonicalHref');?>" />
来源:https://stackoverflow.com/questions/49754469/how-to-implement-canonical-tag-in-pimcore-cms