forked from dachcom-digital/pimcore-i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add canonical readme. check hardlink context before removing canonica…
…l link
- Loading branch information
Showing
6 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
# Countries | ||
# Country | ||
This is only required if you're using i18n with a country adapter. | ||
There are two ways to implement a country page like `en-us`: | ||
|
||
1. Copy and paste the `en` document tree and rename `en` to `en-us`. | ||
2. Create a hardlink, call it `en-us` and set the reference to `en`. | ||
|
||
If you're using a hardlink, check out the [canonical information part](80_CanonicalLinks.md). | ||
|
||
## Preparation | ||
Localize your [documents first](26_Languages.md). | ||
|
||
## Country Wrapper | ||
If you're using a hardlink for country specific data, create it. Otherwise just create a document as you would normally do. | ||
If you're using a hardlink for country specific data, create it. | ||
Otherwise just create a document as you would normally do. | ||
|
||
1. Create a document property (dropdown or text) and call it `country`. | ||
2. Apply the property to all your global pages (like /de, /en) and set the value to `GLOBAL` | ||
3. Apply the property to all your real website hardlinks/documents and set the desired country ISO-Code (uppercase) | ||
2. Apply the property to all your global pages (like `/de`, `/en`) and set the value to `GLOBAL` | ||
3. Apply the property to all your real website hardlinks/documents and set the desired country ISO-Code (uppercase) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Canonical Links | ||
If you're using hardlinks as country wrapper, there is something you need to know: | ||
Pimcore automatically adds a canonical link to each request header, if a page is wrapped into a hardlink. | ||
|
||
## Explanation | ||
|
||
```markdown | ||
Document: `/en/news` | ||
HardLink: `/en-us` (source path would be `/en`) | ||
``` | ||
|
||
Since the `news` document only exists in `/en`, pimcore adds a canonical link to avoid duplicate content - which is perfectly fine. | ||
So if you're going to check the page `/en-us/news`, there should be a canonical relation like this: | ||
|
||
```markdown | ||
HTTP/2 200 | ||
link: <https://pimcore5-domain4.dev/en/news>; rel="canonical" | ||
``` | ||
|
||
But in this case, we want to remove the canonical link because we need country specific content and we'll tell search engines about the references via [href-lang tags](25_HrefLang.md) anyway. | ||
So the i18nBundle will remove this canonical tag automatically for your. If you check your http request after installing this bundle, the canonical link will be gone. | ||
|
||
## Oh no! | ||
**But!** What if you have some hardlinks inside the country site? For Example: | ||
|
||
```markdown | ||
Document: `/en-us/products/demo` | ||
HardLink: `/en-us/special-products` (source path would be `/en-us/products`) | ||
``` | ||
|
||
Don't worry. Just check the header for `/en-us/special-products/demo`, the canonical relation is still available. The I18nBundle only checks hardlinks on root (`/`), since that's the only place where country based hardlinks makes sense. | ||
|
||
```markdown | ||
HTTP/2 200 | ||
link: <https://pimcore5-domain4.dev/en-us/products/demo>; rel="canonical" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters