Skip to content

Commit

Permalink
add internal link rewriter docs
Browse files Browse the repository at this point in the history
  • Loading branch information
solverat committed Oct 1, 2017
1 parent efa0189 commit b9f5caa
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion docs/26_Languages.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
4 changes: 2 additions & 2 deletions docs/27_Countries.md
Original file line number Diff line number Diff line change
@@ -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`.

Expand Down
2 changes: 1 addition & 1 deletion docs/80_CanonicalLinks.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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.
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:
Expand Down
35 changes: 35 additions & 0 deletions docs/90_InternalLinkRewriter.md
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit b9f5caa

Please sign in to comment.