如何在 Shopware 中管理 SEO-Urls?

How to manage SEO-Urls in Shopware?

似乎 Shopware 在生成 URL 时有一些 "magic behind",我正在寻找可以向我解释的人。

standard-template 的

This is the code 生成 SEO-urls 可以在后端的 SEO-router-settings 中配置的变量:

{* Product name *}
{block name='frontend_listing_box_article_name'}
    <a href="{$sArticle.linkDetails|rewrite:$sArticle.articleName}"
       class="product--title"
       title="{$sArticle.articleName|escape}">
        {$sArticle.articleName|truncate:50}
    </a>
{/block}

SEO-router-settings 中的配置默认如下所示:

无论如何,输出有点不同:

http://www.DOMAIN.de/shop/CATEGORYNAME/18/PRODUCTTITLE?c=7

(所有大写字母都显示了真正正确的域、类别和 product-names,为了我客户的隐私,这些都隐藏在这里)

这里的问题是 URL-Parameter "?c=7" 是不需要的,应该按照 SEO-router-options 中的定义省略。

第一个问题:如何在URL的末尾省略这个URL-parameter"c=7"?

当我调试这段代码时,我 运行 遇到了奇怪的事情。以下代码将导致两个不同的 URLs,尽管它是执行相同的术语:

这些是这里的问题:

  1. {$sArticle.linkDetails|rewrite:$sArticle.articleName} 的输出在 href-Attribute 和第二个输出之间是不同的,因为link.
  2. 的标题
  3. {$sArticle.linkDetails|rewrite:$sArticle.articleName} 在 href-Attribute 中的输出将添加一个 URL-Parameter 到描述不需要的类别 ID:“?c=7”

第二题:

同样的template-code怎么会有如此不同?幕后有什么魔法?

我相信您熟悉 Shopware 后端。请看我的简短回答:

  1. 要从详细信息页面 url 中删除“?c=7”:

Set 'Remove CategoryID from Url = No' at Seo/router settings. Then clear cache.

  1. 我认为存在多个商店或者您从其他电子商务系统迁移到商店软件。

You can see the connection between those 2 links at "s_core_rewrite_urls" table. Just backup the table & empty it. Click on Configuration > Cache/performance menu item and do "Rebuild SEO URL index".

可在 https://developers.shopware.com/blog/2015/08/11/the-shopware-seo-engine/

获取更多信息