Skip to content

Commit

Permalink
TASK: Update documentation and add setting `Neos.Seo.alternateLanguag…
Browse files Browse the repository at this point in the history
…eLinks.excludedDimensionsPresets`
  • Loading branch information
ahaeslich committed May 2, 2023
1 parent e2addbb commit b89ce19
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 51 deletions.
3 changes: 3 additions & 0 deletions Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Neos:
'Neos.Seo.Image': 'Neos\Seo\Fusion\Helper\ImageHelper'

Seo:
# hreflang settings
alternateLanguageLinks:
excludedDimensionsPresets: []
# robots.txt settings
robotsTxt:
dimensionsPresets: null
Expand Down
58 changes: 9 additions & 49 deletions Documentation/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,64 +252,24 @@ Alternatively you can change the caching behavior and have a cron job that recre
Alternate Language Tag
------------------------

The `Alternate Language Tag` provides information that the site is also available in other languages. By default the tags
are rendered with the `Neos.Neos:DimensionMenu` and the `language` dimension. Given the Neos Demo Site Package as an
The `Alternate Language Tag` provides information that the site is also available in other languages. Given the Neos Demo Site Package as an
example the rendered tags for the homepage would be.

::

<link rel="alternate" hreflang="en_US" href="http://neos.dev/"/>
<link rel="alternate" hreflang="en_UK" href="http://neos.dev/uk"/>
<link rel="alternate" hreflang="de" href="http://neos.dev/de/"/>

According to the following dimension settings, there would be a lot more tags expected. However only two variants of the
homepage exists, thus only `en_US` and its fallback `en_UK` are rendered.

In case the dimension that contains the language is not named `language` you have to set the alternative name with the
property `ContentRepository.dimensionTypes.language`.
If you only want to render a subset of the available language dimensions (e.g., if the content is not yet ready)
you can configure this in the `Settings.yaml`::

::
Neos:
Seo:
alternateLanguageLinks:
# Show all but exclude German
excludedDimensionsPresets: ['de']

ContentRepository:
contentDimensions:
'language':
label: 'Language'
icon: 'icon-language'
default: 'en_US'
defaultPreset: 'en_US'
presets:
'all': ~
'en_US':
label: 'English (US)'
values: ['en_US']
uriSegment: 'en'
'en_UK':
label: 'English (UK)'
values: ['en_UK', 'en_US']
uriSegment: 'uk'
'de':
label: 'German'
values: ['de']
uriSegment: 'de'
'fr':
label: 'French'
values: ['fr']
uriSegment: 'fr'
'nl':
label: 'Dutch'
values: ['nl', 'de']
uriSegment: 'nl'
'dk':
label: 'Danish'
values: ['dk']
uriSegment: 'dk'
'lv':
label: 'Latvian'
values: ['lv']
uriSegment: 'lv'
dimensionTypes:
language: 'language'

You can exclude presets by overriding `Neos.Seo:AlternateLanguageLinks`.

Dynamic robots.txt
------------------
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Check the [documentation](https://neos-seo.readthedocs.io/en/stable/) for all fe

1. Run the following command f.e. in your site package:
```bash
composer require --no-update "neos/seo:^3.3"
composer require --no-update "neos/seo:^4.1"
```

2. Update your dependencies by running the following command in your project root folder:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ prototype(Neos.Seo:AlternateLanguageLinks) < prototype(Neos.Fusion:Component) {

node = ${documentNode}
dimension = 'language'
excludedPresets = ${[]}
excludedPresets = ${Configuration.setting('Neos.Seo.alternateLanguageLinks.excludedDimensionsPresets')}

# The hreflang value needs to have a format like 'en-US', therefore internally used values
# like 'en_US' will be modified to match.
Expand Down

0 comments on commit b89ce19

Please sign in to comment.