From b9f5caa25c7406d6c4ffc3c587f1f233ae1929c4 Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Sun, 1 Oct 2017 13:54:31 +0200 Subject: [PATCH] add internal link rewriter docs --- README.md | 5 +++-- docs/26_Languages.md | 2 +- docs/27_Countries.md | 4 ++-- docs/80_CanonicalLinks.md | 2 +- docs/90_InternalLinkRewriter.md | 35 +++++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 docs/90_InternalLinkRewriter.md diff --git a/README.md b/README.md index f47ea24..db59354 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,9 @@ This Bundle helps you mastering this challenges and gives you freedom to elabora - [Localized Error Documents](docs/40_LocaleErrorDocument.md): Learn how to create localized error documents. - [Custom Adapter](docs/50_CustomAdapter.md): Learn how to create a custom adapter. - [Code Examples](docs/60_CodeExamples.md): See some examples. -- [Context Switch Event](docs/70_ContextSwitch.md): Detect Zone/Language/Country Switches. -- [Canonical Links](docs/80_CanonicalLinks.md): Canonical Links in Hardlinks. +- [Context Switch Event](docs/70_ContextSwitch.md): Detect zone/language/country switches. +- [Canonical Links](docs/80_CanonicalLinks.md): Canonical links in Hardlinks. +- [Internal Links](docs/90_InternalLinkRewriter.md): Rewrite Internal Links. ## Copyright and License Copyright: [DACHCOM.DIGITAL](http://dachcom-digital.ch) diff --git a/docs/26_Languages.md b/docs/26_Languages.md index 554b5e9..02452a3 100644 --- a/docs/26_Languages.md +++ b/docs/26_Languages.md @@ -1,4 +1,4 @@ -# Languages +# create a website with language context 1. [Enable all](https://pimcore.com/docs/5.0.x/Multi_Language_i18n/index.html) required languages in pimcore backend. 2. [Localize your Documents](https://pimcore.com/docs/5.0.x/Multi_Language_i18n/Localize_your_Documents.html). diff --git a/docs/27_Countries.md b/docs/27_Countries.md index df5dd97..a057a5c 100644 --- a/docs/27_Countries.md +++ b/docs/27_Countries.md @@ -1,7 +1,7 @@ -# Country +# create a website with country context 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`: +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`. diff --git a/docs/80_CanonicalLinks.md b/docs/80_CanonicalLinks.md index 89cedb5..b7f46e3 100644 --- a/docs/80_CanonicalLinks.md +++ b/docs/80_CanonicalLinks.md @@ -18,7 +18,7 @@ link: ; 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. +So the i18nBundle will remove this canonical tag automatically for you. 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: diff --git a/docs/90_InternalLinkRewriter.md b/docs/90_InternalLinkRewriter.md new file mode 100644 index 0000000..83c707f --- /dev/null +++ b/docs/90_InternalLinkRewriter.md @@ -0,0 +1,35 @@ +# Internal Link Rewriter +We love the hardlink context. Creating sites for different countries was never easier with pimcore. +But there are also some challenges. After we found a solution for the [canonical](80_CanonicalLinks.md) relation, there is still "one more thing": + +## Example +You have one simple page, call it `/en`. You also need some content pages, so here we go: + +```markdown +/en + - about (document) + - company (document) + - team (link to /en/company) +``` +But now your client needs this page also for the US (and he also tells you that the most of the content should stay the same). +Not a problem you think - just create a hardlink with [country references](27_Countries.md), like we learned before. + +Your page tree may looks like this: + +```markdown +/en + - about (document) + - company (document) + - team (link to /en/company) +/en-us (hardlink) + - special-content-for-the-us +``` +Now open the link `en-us/team`: It will lead you to `en/company` page, which is bad. Very bad. +But hey - there are good news, we also found a solution for that. We implemented two listeners: + +### LinkPathListener +Every redirect will be transformed to the right context. +The link from `/en-us/team` will redirect you to `/en-us/team`. + +### FrontendPathListener +If there is a link element in `/en/about` which points to `/en/company`, this listener will transform it automatically to `/en-us/company` as long the user is located in `/en-us`. \ No newline at end of file