Using the Gentics CMS Feature Nice URLs one resource may be reachable with different URLs.

It is highly advisable to communicate this to search engine crawlers to avoid duplicate content. See Consolidate duplicate URLs.

  • First make sure you have the fields nice_url and alternate_urls setup in your projects contentrepository’s tagmap.

  • Add the fields to your graphQl query (content.graphql)

  • Use this example implementation in a blade template as a content of the <head> element:

@if (empty($node['fields']['nice_url']))
<link rel="canonical" href="{{$node['path']}}" />
<link rel="canonical" href="{{$node['fields']['nice_url']}}" />
<link rel="alternate" href="{{$node['path']}}" />
@foreach ($node['fields']['alternate_urls'] as $alternate_url)
<link rel="alternate" href="{{$alternate_url}}" />