thelia / canonical-url-module
2.1.7
2024-07-02 10:48 UTC
Requires
- thelia/installer: ~1.1
README
此模块为您的商店的每一页生成一个标准URL。一旦激活,您将在页面的页眉中找到一个 <link rel="canonical" href="..." />
标签。
示例
-
如果页面URL没有重写,标准URL将包含所有URL参数。例如,对于URL
http://demo.thelia.net/?view=product&locale=en_US&product_id=18
<link rel="canonical" href="http://demo.thelia.net/?view=product&locale=en_US&product_id=18" />
显然,这远非理想。请考虑激活URL重写!
-
当页面URL包含脚本名(index.php)时,它将从标准URL中删除。例如,URL
http://demo.thelia.net/index.php?view=product&locale=en_US&product_id=18
的标准URL是<link rel="canonical" href="http://demo.thelia.net/?view=product&locale=en_US&product_id=18" />
当重写后的URL包含参数时,这些参数将被删除。对于
http://demo.thelia.net/index.php/en_en-your-path.html?page=44
,标准URL是<link rel="canonical" href="http://demo.thelia.net/en_en-your-path" />
-
如果页面URL包含的不是主商店域名,此域名将被主商店域名替换。例如,对于
http://demo458.thelia.net/index.php/en_en-your-path.html?page=44
,标准URL是<link rel="canonical" href="http://demo.thelia.net/en_en-your-path" />
安装
手动
- 将模块复制到
<thelia_root>/local/modules/
目录,并确保模块名称为CanonicalUrl。 - 在thelia管理面板中激活它
Composer
将其添加到您的thelia composer.json主文件中
composer require thelia/canonical-url-module:~2.1
用法
您只需激活该模块并检查商店的元标签。
标准URL将自动生成,但您可以通过SEO表单为每个项目定义一个标准URL以覆盖生成的URL。