Sharing content

Content Hub enables each website in a content network to publish content to the central repository, from which other websites can import the content. A website in a content network can act as a publisher for some content and a subscriber for other content. The original publisher of a content entity controls the definitive content of the entity, and any changes made by a subscriber website that imported the content entity are not contributed back into Content Hub. The Content Hub API enables client applications to act directly on Content Hub, creating, modifying, and deleting content entities.

Learning Services logoFor a step-by-step video tutorial introducing you to personalization with Acquia Lift, including content, see Creating Personalized Experiences with Acquia Lift.

What can be shared?

Content Hub supports sharing of entities, such as nodes and taxonomies. The hub is concerned with the sharing of content. It is possible to share taxonomy terms, additional layout elements (including sharing blocks and panels), or configuration information (such as field configuration) with Content Hub.

Content Hub and its Drupal modules do not currently support every entity or use case. Some contributed modules implement entities that are compatible with Content Hub, including the following:

For specific configuration information, see Modules to use with Content Hub .

Important

  • Fields that are shared across publishers and subscribers must share the same attributes, such as type or size. If this is not the case, content may not import correctly.
  • Content can not be shared between Drupal 7 and Drupal 8 websites.

To ensure the data from your production environment is not corrupted by data from non-production environments, configure per-environment settings.

Configuring shared content entities in the Content Hub client

To share content from your website to other members of your content network, you need to configure which entity types you want to make available for sharing. You can configure this in the Drupal administration page for the Content Hub client.

  1. In the admin menu, go to Configuration > Content Hub Connector, and then click the Entity Configuration tab.

  2. Select the entity types that you want to make available for sharing. All entities of these types will be shared through the Content Hub and made available to all the other members of your Content Hub network. You can choose not to share specific properties of a shared entity type. See Excluded properties.

  3. Ensure that you have selected at least one view mode for every content type that you want to publish. Acquia Lift can import nodes from Content Hub for both Drupal 7 and Drupal 8.

    Select a view mode

    Important

    If your entity type contains entity references (such as a blog entity type containing references to media or file entities), for the referenced content to be available for display with the blog entity type, the referenced entities must also be shared with Content Hub. The field for the entity reference must specify a bundle, and that bundle must also contain at least one view mode.

    If the entity reference was created before configuring Content Hub, ensure that the referenced entities are syndicated to Content Hub before referencing them in other entities — failing to do so will cause them to not be displayed.

  4. In the User Role list, click a role to determine how the content type will be rendered. Content Hub will use the permissions of the selected role for both displayed content and generated CDF data.

    In many cases, the Anonymous user default option is fine. However, if applicable, be sure to select the proper role to ensure that subscribing websites do not receive sensitive data.

  5. Click Save configuration.

View modes determine the way a piece of content is displayed. Drupal has several built-in view modes, and others may be added by users. Drupal 8 makes use of these view modes to enable users to more easily control their content across multiple websites. If you change the publishing website’s view mode configuration, you must resync your content between your website and Content Hub.

To resync your content, complete the following steps:

  1. Go to Content > Content Hub.
  2. In the Keyword field, enter the type of content you changed, such as article.
  3. Select the checkbox next to Import to site to select all content.
  4. Click Import to site.

For information about custom blocks and view modes, see Using blocks with Content Hub.

Which entities are shared

To be shared, an entity type must exist on both the publisher (source) website and the subscriber (target or consumer) website. The entity type does not need to be defined with exactly the same fields. Fields in shared entities that don’t exist on the subscriber website will be ignored.

Sharing Taxonomy terms

To be shared, taxonomy vocabularies must exist on both the publisher (source) website and the subscriber (target or consumer) website. Taxonomy terms will be syndicated with the entities that they are attached to. If a taxonomy term exists on the subscribing website and has the same UUID as the publishing website, the term will be used on the subscribing website. If the vocabulary exists on both websites but the term does not—or the UUIDs do not match—the term will be added to the subscribing website, potentially resulting in term duplication.

Sharing Blocks

Because blocks are not entities in Drupal 7, the Content Hub Blocks module for Drupal 7 (included with Content Hub) must be enabled to share blocks. This module allows Drupal 7 blocks to be pushed to Content Hub as rendered content entities. These rendered entities are only available to be used for personalization and cannot be syndicated.

Note

Blocks and entities created with the Drupal 7 Bean module are fully supported for content syndication and personalization.

To enable this module, complete the following steps:

  1. Sign in to your website as an administrator, and in the admin menu, click Modules.
  2. Select the check box for the Content Hub for Blocks module.
  3. Scroll to the end of the webpage, and then click Save configuration.
  4. In the admin menu, go to Configuration > Content Hub Connector, and then click the Entity Configuration tab
  5. Select the block content types that you want to make available for sharing.
  6. Click Save configuration.

After enabling the module, a Publish to Content Hub check box will appear on the block editing page. The enabled module also provides the following Drush command to export blocks by block ID:

drush -l [URI] ch-export-block [blockID]

Using multiple languages

Content Hub supports sharing of content containing multiple language translations. Content import relies on the languages and translations that are defined and supported on subscribing websites. Languages and translations that are not defined will be skipped.

As an example, when a publishing website provides content translated into languages A and B, and the subscribing website only uses languages B and C, then the translation of language B (the shared language on both websites) should import successfully from the publishing website to the subscriber website.

Configuring webhooks

To receive content from other members of your content network, you need to set up webhooks on your website. To do this, complete the following steps:

  1. In the admin menu, go to Configuration > Content Hub Connector, and then click the Webhooks tab.

  2. Enter the webhook URL. The default webhook URL is:

    http://[site_URL]/content-hub/webhook
    
  3. Click Save configuration.

Note

Because the IP addresses used by the Content Hub service can change frequently, it is not practical to use a whitelist to enable connection between your website and Content Hub.

Content Hub requires a valid SSL certificate on the domain if you want your webhooks to transfer data with a SSL connection. If you want to use Content Hub with an invalid SSL certificate during your development phase, you must use http:// URLs on pages that trigger content exports (such as node editing forms) and ensure that your webhook URL is a non-SSL URL in your webhook settings form.

Deleting content using webhooks

When content is unpublished or deleted from your publishing website, you may also want to remove the content from your subscribing websites. To do this, create a small, custom module, as described in Deleting content from Content Hub.

Troubleshooting webhooks

If Content Hub cannot send webhooks to a subscribing website, it also cannot notify the subscribing website of a problem with the webhook. If a webhook fails for four days, Content Hub will remove the webhook and then add the following error message to the history log regarding the failure:

A webhook endpoint has been automatically removed, because webhook delivery
has failed to that URL for a long time (URL: [URL to endpoint])

To review the history logs for Content Hub, use the /v1/history API endpoint. For more information, see Using the Content Hub API.

Removing and reindexing by content type

If you alter content types on a subscribing website, and want Content Hub to use the new or altered fields in your content type, you can use drush ach-reset to remove, reset, reindex, and reimport all entities matching the content type you specify.

Contact supportStill need assistance? Contact Acquia Support

Acquia: Think Ahead

53 State Street, 10th Floor
Boston, MA 02109
United States
Phone: 888-922-7842

Map: Google Maps
View other locations