我应该如何在prestashop主题中实现规范网址?

时间:2016-01-28 14:40:22

标签: seo prestashop canonical-link

规范网址目前已在商店中激活,但不会在前端源代码中写入。所以我看了一下default-bootsrap主题,最后一个来自github,但它似乎没有实现任何规范网址。

我还检查了所有控制器,但似乎没有人设置$ canonical_url(类似......)smarty var,那么相关的后台选项到底是什么?

我在网上搜索但发现没什么用处。

1 个答案:

答案 0 :(得分:1)

后台选项Canonical url仅用于控制器。

如果您已激活网址重写选项并尝试访问此链接:

$("button").on("click", function() {
    $text.stop(true, false);
})

您将被重定向到,例如:

http://dev.test.com/index.php?id_product=1&controller=product

以下是来自http://dev.test.com/tshirts/1-T-shirts-a-manches-courtes-delaves.html 类的canonicalRedirection方法的摘录:

FrontController

在此方法中,我们使用此行/** * Redirects to canonical URL * * @param string $canonical_url */ protected function canonicalRedirection($canonical_url = '') { [...] $redirect_type = Configuration::get('PS_CANONICAL_REDIRECT') == 2 ? '301' : '302'; header('HTTP/1.0 '.$redirect_type.' Moved'); header('Cache-Control: no-cache'); Tools::redirectLink($final_url); } 获取您在BackOffice中选择的规范重定向选项。

如果你想在你的html标题中使用规范网址,你必须编写或获取一个模块,因为它不包含在Prestashop中。