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.
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 additional layout elements (including 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.
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.
- In the admin menu, go to Configuration > Content Hub Connector, and then click the Entity Configuration tab.
- 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.
- 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.
- 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.
- 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:
- Go to Content > Content Hub.
- In the Keyword field, enter the type of content you changed, such as
- Select the checkbox next to Import to site to select all content.
- 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.
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.
To enable this module, complete the following steps:
- Sign in to your website as an administrator, and in the admin menu, click Modules.
- Select the check box for the Content Hub for Blocks module.
- At the bottom of the page, click Save configuration.
- In the admin menu, go to Configuration > Content Hub Connector, and then click the Entity Configuration tab
- Select the block content types that you want to make available for sharing.
- 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]
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:
- In the admin menu, go to Configuration > Content Hub Connector, and then click the Webhooks tab.
- Enter the webhook URL. The default webhook URL is:
- Click Save configuration.
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.
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])
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.