pdoTools
pdoTools copied to clipboard
Incorrect next/prev canonical URLs
With link_tag_scheme set to abs and a website which has a base_url set to /en-en/ the generated prev/next canonical URLs are incorrect, having a duplicate /en-en/.
Example output:
<link rel="canonical" href="https://www.domain.tld/en-en/en-en/products"/>
<link rel="next" href="https://www.domain.comtld/en-en/en-en/products?page=2"/>
This is due to the getBaseUrl function in pdoPage class.
$host = '';
switch ($this->pdoTools->config['scheme']) {
case 'full':
$host = $this->modx->getOption('site_url');
break;
case 'abs':
case 'absolute':
$host = $this->modx->getOption('base_url');
break;
case 'https':
case 'http':
$host = $this->pdoTools->config['scheme'] . '://' . $this->modx->getOption('http_host') .
$this->modx->getOption('base_url');
break;
}
$url = $host . $q_val;
I think this should be altered to?
case 'abs':
case 'absolute':
$host = '';
break;
Fixed in MODX 3.