Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1717

Joomla! 5.x Coding • Re: Behavior-Backward Compatibility plugin unchecked: issue with the Canonical URL SEO

$
0
0
After a thousand attempts, I found the origin of the issue.
It is in the override file: html/com_content/article/default.php , created to use Joomla Custom Fields to Add Canonical URLs.

The code that generates the error is as follows:

Code:

//Check custom fields for canonical linkforeach ($this->item->jcfields as $field) {if ($field->title === 'Canonical URL') {//Make sure the field isn't emptyif ($field->rawvalue !== '') {$canonicalLink = '<link rel="canonical" href="' . $field->rawvalue . '" />';$document = JFactory::getDocument();$document->addCustomTag($canonicalLink);}continue;}};
What correction do you suggest?

Statistics: Posted by sgiobbio — Mon Apr 08, 2024 9:04 pm



Viewing all articles
Browse latest Browse all 1717

Trending Articles