Information for: DEVELOPERS   PARTNERS

Sharing content

This page and its sub-pages refer to sharing content in Acquia Content Hub 1.x.

Acquia 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; any changes made by a subscriber website which imported the content entity aren’t contributed back into Acquia Content Hub. The Acquia Content Hub API enables client applications to act directly on Acquia Content Hub by 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

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

Acquia Content Hub and its Drupal modules don’t support every entity or use case. Some contributed modules create entities compatible with Acquia Content Hub, including the following:

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

Important

  • Fields which are shared across publishers and subscribers must share the same attributes, such as type or size. If they don’t share attributes, content may not import correctly.
  • Content can’t be shared between Drupal 7 and Drupal 8 websites.
  • To ensure the data from your production environment isn’t corrupted by data from non-production environments, download and configure the per-environment settings file.

Configuring shared content entities in the Content Hub client

To share content from your website to other members of your content network, you must configure which entity types you want to make available for sharing. You can configure the entity types in the Drupal administration page for the Acquia 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 you want to make available for sharing. All entities of the selected types will be shared through the Acquia Content Hub and made available to all the other members of your Acquia Content Hub network. You can choose not to share specific properties of a shared entity type. See Acquia Content Hub connector settings.

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

    Select a view mode

    Important

    If your entity type uses 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 Acquia 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 Acquia Content Hub, ensure the referenced entities are syndicated to Acquia Content Hub before referencing them in other entities – failing to do so will cause them not to display.

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

    Often, the Anonymous user default option is fine. If applicable, be sure to select the proper role to ensure subscribing websites don’t receive sensitive data.

  5. Click Save configuration.

View modes determine the way a piece of content displays. Drupal has several built-in view modes, and users can add others. Drupal 8 makes use of view modes to enable users to control their content across multiple websites. If you change the publishing website’s view mode configuration, you must re-sync your content between your website and Acquia Content Hub.

To re-sync your content, complete the following steps:

  1. Go to Content > Content Hub.
  2. In the Keyword field, enter the content type 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

An entity type must exist on both the publisher (source) website and the subscriber (target or consumer) website to be shared. The entity type definition doesn’t need the exact same fields. The subscriber website ignores fields in shared entities which don’t exist on the subscriber website.

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 syndicate with the entities 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 doesn’t, or the UUIDs don’t match, the the subscribing website adds the term, which may result in term duplication.

Sharing blocks

Blocks aren’t entities in Drupal 7, so you must enable the Content Hub Blocks module for Drupal 7 (included with Acquia Content Hub) to share blocks. This module allows Drupal 7 blocks to be pushed to Acquia Content Hub as rendered content entities. The rendered entities are available for personalization use, and can’t be syndicated.

Note

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

To enable the 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 you want to make available for sharing.
  6. Click Save configuration.

After enabling the module, a Publish to Content Hub check box will be displayed 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

Acquia Content Hub supports sharing of content containing multiple language translations. Content import relies on the languages and translations defined and supported on subscribing websites. Languages and translations which aren’t defined don’t import.

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

Configuring webhooks

To receive content from other members of your content network, you must set up webhooks on your website. To do so, 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

Since the IP addresses used by the Acquia Content Hub service can change often, it’s not practical to use a whitelist to enable connection between your website and Content Hub. If you require password protection of a website, you must whitelist the webhook URL path to be publicly accessible.

To register a webhook with Content Hub, the publicly accessible URL must be an externally accessible URL. It can’t be behind a firewall or use password protection such as the Shield module or an .htaccess password. Content Hub must communicate with a subscriber’s website, and receive a valid response from the URL.

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 which trigger content exports (such as node editing forms) and ensure 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 subscribing sites.

Troubleshooting webhooks

The following webhook information is for Drupal 7 and Drupal 8.

If Acquia Content Hub can’t send webhooks to a subscribing website, it also can’t notify the subscribing website of a problem with the webhook. If a webhook fails or is unreachable for 72 hours, Acquia Content Hub will suppress the webhook for 12 hours. During the 12-hour window, the webhook won’t receive any updates until it’s either manually enabled within the window, or unsuppressed after 12 hours.

After Acquia Content Hub suppresses a webhook, you can enable it again using one of the following methods:

  • Wait 12 hours for Acquia Content Hub to re-enable the webhook.
  • Use the webhook enable API endpoint
  • Send a POST request to the v1/settings/webhooks endpoint.

Note

Acquia Content Hub deletes ngrok.io development webhook endpoints unreachable for more than 72 hours.

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

Removing and reindexing by content type

If you alter content types on a subscribing website, and want Acquia 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.