Setting up rel canonical with drupal 8

tagsdrupal8

 

Solve:

We use the Metatag module.

A link to the preferred page location or URL of the content of this page, to help eliminate duplicate content penalties from search engines.

Consolidate duplicate URLs

Define a canonical page for similar or duplicate pages
If you have a single page accessible by multiple URLs, or different pages with similar content (for example, a page with both a mobile and a desktop version), Google sees these as duplicate versions of the same page. Google will choose one URL as the canonical version and crawl that, and all other URLs will be considered duplicate URLs and crawled less often.

The Metatag module allows you to automatically provide structured metadata, aka "meta tags", about a website. In the context of search engine optimization, when people refer to meta tags they are usually referring to the meta description tag and the meta keywords tag that may help improve the rankings and display of a site in search engine results. In addition, the module provides support for meta tags (Open Graph Protocol from Facebook, Twitter Cards from Twitter) that allow control of how content appears when shared on social networks.

This project is the offical Drupal 7 and D8 successor of the Nodewords module. As of v7.x-1.5 a submodule (Metatag:Importer) is provided to convert data from

metatags1

Features

  • Supports a large number of commonly used meta tags, including the page title, canonical URL, description, etc, and for Facebook's Open GraphTwitter Cards and Dublin Core via included submodules (see full list).
  • Global settings to control meta tags on all pages.
  • Per entity and per entity bundle to control default meta tags for all items of a certain type, e.g. all nodes of a certain content type.
  • Ability to override meta tags on each entity object, e.g. to override meta tags on an individual node.
  • Multi-lingual support using the Entity Translation module and translation support using the Internationalization (i18n) module.
  • Full support for entity revisions and workflows based upon revision editing, including compatibility with the Revisioning and Workbench Moderation modules.
  • D8: Customize meta tags for specific paths (or other conditions) using Context and included Metatag:Context submodule.
  • D8: Customize meta tags for custom pages built using Panels and Views using included submodules.
  • D8: Individual permissions for each meta tag can be enabled (see README.txt).
  • D8: Meta tags can be optionally added to admin pages.
  • Exportable default meta tag configuration.
  • Extendable and flexible API for define new meta tags.
  • D8: Support for Devel Generate (sub-module)