Topic on Extension talk:CanonURL

Patch: Redirects support

2
Vlsergey (talkcontribs)
        if (isset($wgArticle)) {
            $out->addHeadItem( 'canonical',
                '<link rel="canonical" href="'.$wgArticle->getTitle()->getFullURL().'" />'."\n");
        } else {
            $out->addHeadItem( 'canonical',
                '<link rel="canonical" href="'.$CanonBaseURL.$pg_title.'" />'."\n");
        }
Krinkle (talkcontribs)

Don't forget to run the attribute value through htmlspecialchars(), and use Title::getCanonicalURL instead of Title::getFullURL so that sites that support both HTTP and HTTPS output the canonical url here instead of the one on the current request.

Reply to "Patch: Redirects support"