This is outdated.

We have launched Content Sync v2. If you are just starting out, please check out the official v2 documentation instead.

Use the content URL from the source site as Canonical tag

To prevent search engines from indexing identical content across your sites and punishing you for “duplicate content”, you can set the canonical tag on your sub-sites to the URL of the content on your source site.

To get the URL of the entity on the source site, you can use:

 

// The following snippet assumes that a node entity is available as a $node variable // that you want to get the source URL for. $source_url = NULL; $status = \Drupal\cms_content_sync\Entity\EntityStatus::getInfosForEntity( $node->getEntityTypeId(), $node->uuid() ); foreach ($status as $candidate) { if ($candidate->isSourceEntity()) { continue; } $source_url = $candidate->getSourceUrl(); if ($source_url) { break; } } // The variable $source_url will now be the full URL to the content on the source site // or NULL if the node wasn't pulled from another site- in this case you can just use the // local URL of the node instead.

Please note that path aliases are not used for the source entity URL as they may change.