You are currently viewing the article on an older Shopware version!
In the SEO settings you can define the structure for the SEO URLs of the product detail pages and categories. For this purpose you have a variety of variables at your disposal.
With the item Sales channel (1) you can determine whether you want to configure the configuration globally for all sales channels or only for a selected sales channel.
If you have selected a specific sales channel and want to go back to the general setting, just click into the selection field and delete the content. Afterwards "All sales channels" will be displayed again.
In the first line you can specify the template for the URL of the product detail page (2). Note that the variables must be specified in Twig format. The structure here is as follows:
{{ product.name }}
Next to the field, a symbol shows you whether the variables stored in the SEO template are valid.
To the right of the field for the SEO-URL template you can choose from several variables. These are automatically added to the back of the SEO-template by clicking on the variable.
It should be noted, that the variables can be multi-level and that these are not added completely. This requires a subsequent manual adjustment in the SEO template field. You can find the complete variables in the list below.
An example of a variable that is incomplete is
{{ product.translated.name }}
In the selection on the right side the variable
{{ product.translated }}
is displayed. However, this is a "multi-level" variable and requires the complete specification of the further level. Here it is therefore necessary to add this manually.
.name
Examples of article variables
Discription | Variable |
---|---|
Order number | {{ product.productNumber }} |
ID | {{ product.id }} |
Name | {{ product.name }} |
EAN | {{ product.ean }} |
Manufacturer name | {{ product.manufacturer.name }} |
Release date | {{ product.releaseDate }} |
Meta Titel | {{ product.metaTitle }} |
Discription | {{ product.description }} |
Keywords | {{ product.keywords }} |
Breadcrumb | {% for part in product.mainCategory.breadcrumb %}{{ part }}/{% endfor %} |
ParentID | {{ product.parentId }} |
Child count (number of variants) | {{ product.childCount }} |
Autoincrement | {{ product.autoIncrement }} |
Tax id | {{ product.taxId }} |
Manufacturer ID | {{ product.manufacturerId }} |
Unit ID | {{ product.unitId }} |
Active | {{ product.active }} |
Display group (group of variants) | {{ product.displayGroup }} |
Price | {{ product.price }} |
Manufacturer number | {{ product.manufacturerNumber }} |
EAN | {{ product.ean }} |
Sales (Completed sales) | {{ product.sales }} |
Stock | {{ product.stock }} |
Available stock | {{ product.availableStock }} |
Product is available | {{ product.available }} |
Delivery ID | {{ product.deliveryTimeId }} |
Delivery time (currently not available) | {{ product.deliveryTime }} |
Restock time | {{ product.restockTime }} |
Close out | {{ product.isCloseout }} |
Purchase steps | {{ product.purchaseSteps }} |
Maximum purchase quantity | {{ product.maxPurchase }} |
Minimum purchase quantity | {{ product.minPurchase }} |
Purchase unit | {{ product.purchaseUnit }} |
Reference unit | { product.referenceUnit }} |
Free shipping costs | {{ product.shippingFree }} |
Gross purchase prices | {{ product.purchasePrices }} |
Mark product as topseller | {{ product.markAsTopseller }} |
Weight | {{ product.weight }} |
Width | {{ product.width }} |
Height | {{ product.height }} |
Length | {{ product.length }} |
Release date | {{ product.releaseDate }} |
Assigned category ID | {{ product.categoryTree }} |
Variant ID | {{ product.optionIds }} |
Property ID | {{ product.propertyIds }} |
Meta description | {{ product.metaDescription }} |
Meta title | {{ product.metaTitle }} |
Packing unit | {{ product.packUnit }} |
Packing unit plural | {{ product.packUnitPlural }} |
Variant restrictions | {{ product.variantRestrictions }} |
Display sequence | {{ product.configuratorGroupConfig }} |
Main variant ID | {{ product.mainVariantId }} |
Product configuration | {{ product.variation }} |
Tax | {{ product.tax }} |
Manufacturer | {{ product.manufacturer }} |
Unit(currently not available) | {{ product.unit }} |
Price(currently not available) | {{ product.prices }} |
Cheapest price(currently not available) | {{ product.cheapestPrice }} |
Cover image (currently not available) | {{ product.cover }} |
Parent product(currently not available) | {{ product.parent }} |
Child / varaint products (currently not available) | {{ product.children }} |
Media (currently not available) | {{ product.media }} |
LayoutID | {{ product.cmsPageId }} |
Layout(currently not available)) | {{ product.cmsPage }} |
Layout slot | {{ product.slotConfig }} |
Search keywords(currently not available) | {{ product.searchKeywords }} |
Translations(currently not available) | {{ product.translations }} |
Custom field set(currently not available) | {{ product.customFieldSets }} |
Tags(currently not available) | {{ product.tags }} |
Variant options(currently not available) | {{ product.options }} |
Variant configurations(currently not available) | {{ product.configuratorSettings }} |
Category information of the directly and indirectly assigned categories (currently not available)) | {{ product.categoriesRo }} |
Category information of the directly assigned categories | {{ product.categories }} |
Media cover ID | {{ product.coverId }} |
Was removed with the 6.4 (currently not available) | {{ product.blacklistIds }} |
Was removed with the 6.4 (currently not available) | {{ product.whitelistIds }} |
All customfield values of the product | {{ product.translated.customFields }} |
Visibility (currently not available) | {{ product.visibilities }} |
Tag IDs | {{ product.tagIds }} |
Product ratings (currently not available) | {{ product.productReviews }} |
Average product rating number | {{ product.ratingAverage }} |
Main category | {{ product.mainCategories }} |
SEO Urls of the product (currently not available) | {{ product.seoUrls }} |
All order items in which the product is used (currently not available) | {{ product.orderLineItems }} |
Crosssellings defined on the product ( currently not available) | {{ product.crossSellings }} |
Product of the canocial (currently not available) | {{ product.crossSellingAssignedProducts }} |
Internal storage object for the most favorable price determination | {{ product.cheapestPriceContainer }} |
Productstream in which the product is stored (currently not available) | {{ product.streams }} |
Internal reference of the ID of the product (should not be used) | {{ product._uniqueIdentifier }} |
ID of the version of the product | {{ product.versionId }} |
Contains all translated values of the product | {{ product.translated }} |
Creation date | {{ product.createdAt }} |
Last change/update | {{ product.updatedAt }} |
Extensions of the product (plugin extensions) | {{ product.extensions }} |
Product ID | {{ product.id }} |
Version ID of the partent product | {{ product.parentVersionId }} |
Stored manufacturer version ID | {{ product.productManufacturerVersionId }} |
Product media cover version ID | {{ product.productMediaVersionId }} |
Stored CMS-layout version ID | {{ product.cmsPageVersionId }} |
There are generally more variables available. However, since these provide content that leads to regular changes in the URL and this has a negative influence on the ranking, we will not go into this further here.
In the second field you can adjust the template for the category page (3). The default category structure (the so-called breadcrumb) is used here. If you want to adjust the template for the categories, you can use the following variables.
Examples of category variables
Description | Variable | |
---|---|---|
Breadcrumb | {% for part in category.seoBreadcrumb %}{{ part }}/{% endfor %} | |
ID | {{ category.id }} | |
Name | {{ category.translated.name }} | |
Meta-Titel | {{ category.translated.metaTitle }} | |
Description | {{ category.description }} | |
Meta-description | {{ category.translated.description }} | |
Category | {{ category }} | |
ID of the parent category | {{ category.parentId }} | |
Automatic enumeration in the database | {{ category.autoIncrement }} | |
ID of assigned image | {{ category.mediaId }} | |
ID`s of the category path | {{ category.path }} | |
Category level | {{ category.level }} | |
Active | {{ category.active }} | |
Number of subcategories | {{ category.childCount }} | |
No longer used | {{ category.displayNestedProducts }} | |
Parent category (currently not available) | {{ category.parent }} | |
Subcategory (currently not available) | {{ category.children }} | |
Translation (currently not available) | {{ category.translations }} | |
Image name (currently not available) | {{ category.media }} | |
Assigned products (currently not available) | {{ category.products }} | |
Is it assigned to one of the subcategories (currently not available) | {{ category.nestedProducts }} | |
Next sub category | {{ category.afterCategoryId }} | |
Custom fields | {{ category.translated.customFields }} | |
Assigned tags (currently not available) | {{ category.tags }} | |
ID of the assigned layout | {{ category.cmsPageId }} | |
Assigned layout (currently not available) | {{ category.cmsPage }} | |
Productstream ID | {{ category.productStreamId }} | |
Productstream (currently not available) | {{ category.productStream }} | |
Should not be used | {{ category.slotConfig }} | |
Sales channels in which this category is used as main navigation (currently not available) | {{ category.navigationSalesChannels }} | |
Sales channels in which this category is used as footer navigation (currently not available) | {{ category.footerSalesChannels }} | |
Sales channels in which this category is used as service navigation (currently not available) | {{ category.serviceSalesChannels }} | |
Entered type of link. Product, category, landing page or external | {{ category.translated.linkType }} | |
The link will open in a new tab? 1 or 0 | {{ category.translated.linkNewTab }} | |
Internal link | {{ category.translated.internalLink }} | |
External link | {{ category.translated.externalLink }} | |
Hide in navigation | {{ category.visible }} | |
Category type page, link or folder | {{ category.type }} | |
Product assignment Manual selection or Dynamic product grou | {{ category.productAssignmentType }} | |
Keywords | {{ category.translated.keywords }} | |
Product allocations of the respective sales channels | {{ category.mainCategories }} | |
SEOUrls | {{ category.seoUrls }} | |
Unique identifier | {{ category._uniqueIdentifier }} | |
VersionID | {{ category.versionId }} | |
(Currently not available) | {{ category.translated }} | |
Date created | {{ category.createdAt }} | |
Modified on | {{ category.updatedAt }} | |
Extensions of the category | {{ category.extensions }} | |
ID of the parent category | {{ category.parentVersionId }} | |
Next sub category versionID | {{ category.afterCategoryVersionId }} | |
Layout versionID | {{ category.cmsPageVersionId }} | |
Associated breadcrumb | {{ category.seoBreadcrumb }} |
It is also possible to integrate filters into the SEO template. This for example allows, the entire URL to be written in lower case.
The filters are added with a "|" separated behind the variable within the {{}}.
For the lower case of the product name this would be possible e.g. as following
without filter
{{ product.translated.name }}/{{ product.productNumber }}
with filter
{{ product.translated.name|lower }}/{{ product.productNumber }}
With a FOR loop this is appended in the {{ part|lower }}. For category pages this looks like this
without filter
{% for part in category.seoBreadcrumb %}{{ part }}/{% endfor %}
with filter
{% for part in category.seoBreadcrumb %}{{ part|lower }}/{% endfor %}
In general you can use the available Twig filters. You can find more information on this in the Twig documentation under https://twig.symfony.com/doc/3.x/filters/index.html
Instead of redirecting Canonical URLs directly to the most recent URL using HTTP 301 (4), this function allows you to output an HTTP 301 redirect when URLs are changed. If the function is disabled, the browser will not display a note on the redirection.
After you have made changes to the SEO template, it is necessary to rebuild the index so that the URLs are updated.
You can do this from the console using the command
php bin/console dal:refresh:index