WS-hreflang-Verlinkungen (EN)
General
If you operate several subshops, then a hreflang specification is helpful for Google, e.g. to avoid duplicate content.
Example:
You have 4 subshops:
a German subshop (SubshopId "de")
a German mobile subshop (SubshopId "m-de")
an Austrian subshop (SubshopId "at")
an Austrian, mobile subshop (SubshopId "m-at")
In all 4 subshops identical products and categories are offered.
WEBSALE offers an automatic hreflang assignment for product and category pages.
The automatic assignment is done for product pages using the same product index in the subshops.
Automatic mapping is done for category pages by default using the same category index in the subshops.
However, some ERP systems manage the categories/products in different subshops with different category indexes/product indexes, even though they are the same categories/products. In this case, you need to pass an assignment list to the shop which categories/products are the same. This documentation describes the structure and import of this mapping list.
Format of the assignment list
The mapping list can be passed either in a JSON file or in a CSV file (tab-delimited), both in UTF-8 format.
Structure of the JSON file for categories
As an example we use our 4 subshops
de
m-de
at
m-at
In all 4 subshops the same categories are managed, but with different category indexes. As an example, 3 categories "Shirts", "Trousers" and "Shoes" are offered in the shop:
Subshop | Category name | Category index |
---|---|---|
de | Shirts | 111-1 |
m-de | Shirts | 111-2 |
at | Shirts | 111-3 |
m-at | Shirts | 111-4 |
de | Trousers | 222-1 |
m-de | Trousers | 222-2 |
at | Trousers | 222-3 |
m-at | Trousers | 222-4 |
de | Shoes | 333-1 |
m-de | Shoes | 333-2 |
at | Shoes | 333-3 |
m-at | Shoes | 333-4 |
Structure of the JSON file:
{
"cat":
[
{
"MasterID": "M1",
"maps":
[
{
"subshop": "de",
"index": "111-1"
},
{
"subshop": "m-de",
"index": "111-2"
},
{
"subshop": "at",
"index": "111-3"
},
{
"subshop": "m-at",
"index": "111-4"
}
]
},
{
"MasterID": "M2",
"maps":
[
{
"subshop": "de",
"index": "222-1"
},
{
"subshop": "m-de",
"index": "222-2"
},
{
"subshop": "at",
"index": "222-3"
},
{
"subshop": "m-at",
"index": "222-4"
}
]
},
{
"MasterID": "M3",
"maps":
[
{
"subshop": "de",
"index": "333-1"
},
{
"subshop": "m-de",
"index": "333-2"
},
{
"subshop": "at",
"index": "333-3"
},
{
"subshop": "m-at",
"index": "333-4"
}
]
}
]
}
The MasterID must be a unique alphanumeric ID for each "maps" array element. Within a "maps" array element, the same categories are assigned in the subshops.
The name of the file is configurable in the shop. However, the ending is mandatory ".json". As default name we recommend "catalloc_complete_g1.json". Currently, only a complete import is possible.
The following hreflang links are then output on the shop category pages:
Subshop | Category name | Example link to category |
---|---|---|
de | Shirts | https://www.xyz.de/Shirts |
m-de | Shirts | https://m.xyz.de/Shirts |
at | Shirts | https://www.xyz.at/Shirts |
m-at | Shirts | https://m.xyz.at/Shirts |
de | Trousers | https://www.xyz.de/Trousers |
m-de | Trousers | https://m.xyz.de/Trousers |
at | Trousers | https://www.xyz.at/Trousers |
m-at | Trousers | https://m.xyz.at/Trousers |
de | Shoes | https://www.xyz.de/Shoes |
m-de | Shoes | https://m.xyz.de/Shoes |
at | Shoes | https://www.xyz.at/Shoes |
m-at | Shoes | https://m.xyz.at/Shoes |
Subshop: de
Category: Shirts
<link rel="alternate" hreflang="de-DE" href="https://m.xyz.de/Shirts" />
<link rel="alternate" hreflang="de-AT" href="https://www.xyz.at/Shirts" />
<link rel="alternate" hreflang="de-AT" href="https://m.xyz.at/Shirts" />
Subshop: m-de
Category: Shirts
<link rel="alternate" hreflang="de-DE" href="https://www.xyz.de/Shirts" />
<link rel="alternate" hreflang="de-AT" href="https://www.xyz.at/Shirts" />
<link rel="alternate" hreflang="de-AT" href="https://m.xyz.at/Shirts" />
Subshop: at
Category: Shirts
Subshop: m-at
Category: Shirts
Subshop: de
Category: Trousers
etc.
Other import files
In the above example we have grouped 4 German language subshops in the file "catalloc_complete_g1.json". For each additional subshop group, another file must be created and imported into the shop.
Example:
In addition to the 4 German-language subshops, you have 2 English subshops that should also be grouped together in another group.
Subshop | Category name | Category index |
---|---|---|
gb | Shirts | 444-1 |
m-gb | Shirts | 444-2 |
gb | Trousers | 555-1 |
m-gb | Trousers | 555-2 |
gb | Shoes | 666-1 |
m-gb | Shoes | 666-2 |
Structure of the JSON file:
The name of this file is then "catalloc_complete_g2.json".
Please note:
The MasterIDs of the 2nd file must be different from the 1st file or from all other files.
Structure of the CSV file for categories
According to our examples above, the CSV files then have the following content:
File "catalloc_complete_g1.csv":
MasterID
M1
M1
M1
M1
M2
M2
M2
M2
M3
M3
M3
M3
SubShop
de
m-de
at
m-at
de
m-de
at
m-at
de
m-de
at
m-at
CatIndex
111-1
111-2
111-3
111-4
222-1
222-2
222-3
222-4
333-1
333-2
333-3
333-4
File "catalloc_complete_g2.csv":
MasterID
M4
M4
M5
M5
M6
M6
SubShop
gb
m-gb
gb
m-gb
gb
m-gb
CatIndex
444-1
444-2
555-1
555-2
666-1
666-2
The first line contains the column headers. From the 2nd line the data follow. The columns are tab-separated.
Structure of the JSON file for products
Analogous to the mapping list for categories (see above) the mapping for products is done. The only difference is the first element of the JSON object "prod" instead of "cat".
Example:
In 2 subshops (de and at) 2 identical products with different product indexes are offered:
Structure of the CSV file for products
Analogous to the assignment list for categories (see above) the assignment for products is done. The only difference is the column header "ProdIndex" instead of "CatIndex":
MasterID
P001
P001
P002
P002
SubShop
de
at
de
at
ProdIndex
1234
4321
5678
8765
Checksum file
A checksum file must be created and transferred for each JSON or CSV file. Form a SHA512 hash value from the complete content of the JSON/CSV file and write it to the first line of the checksum file.
The extension of the checksum file is ".sha512sum".
Example:
You have 2 JSON files
catalloc_complete_g1.json
catalloc_complete_g2.json
then the checksum files are
catalloc_complete_g1.sha512sum
catalloc_complete_g2.sha512sum
Importing the files
The JSON/CSV and checksum files are transferred via SFTP. You will receive an SFTP access from WEBSALE AG for this purpose. Save the files directly in your root directory. The import is done once a day (at night) via cron job
Alternatively, the import can also be triggered via REST API. Then the files can also be transferred and imported several times a day. You can find out how to start the "hrefCollector" via REST in the REST interface for OSB services: REST hreflang-Erzeugung