Joomla! SEO Pagination

Similarly to page titles, avoid having duplicate meta descriptions. This article will help you the deal with this issue.

With a little help from PHP, you can solve the problem with duplicate titles and duplicate meta descriptions in joomla. Use this php code in your overrides.
We use the category blog override as example.

  • go to System Dashboard (Joomla! 4) -> 'Site Templates', and click on the name of the template you are using
  • Go to the 'Create Overrides' tab
  • Under components, select 'com_content' -> 'category'
  • Go to the 'Editor' tab
  • Under 'html' -> 'com_content' select 'blog.php'

put this little code snippet in this file


if (($this->params->def('show_pagination', 1) == 1 || ($this->params->get('show_pagination') == 2)) && ($this->pagination->pagesTotal > 1)) :
	$doc = Factory::getDocument();
	$doc->setTitle( $doc->getTitle() . ' '. Text::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $this->pagination->pagesCurrent, $this->pagination->pagesTotal) );
	$doc->setDescription($doc->getMetaData('description') . ' '. Text::sprintf('JLIB_HTML_PAGE_CURRENT_OF_TOTAL', $this->pagination->pagesCurrent, $this->pagination->pagesTotal) );
endif;

make sure you use 'Factory class' and 'Text class'


use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;

Now your page title will look something like "Your Site Title - example.com Page 1 of 3".
ui/Theme-Builder Pro use this technique in html overrides.

1000 Characters left

Terms & Conditions

Subscribe

Report