Global Components in Content Hub
Sometimes there may be a need to add a component to every page in Content Hub - perhaps an external component, a banner, or the javascript for an external integration. Rather than going through every single page (and sub-page 😮), thankfully we can just do this once (mostly).
Method
The key here is master layouts. Each page has a master layout and these can have components added directly to them. Therefore, whilst not being strictly global, we can add a component to multiple pages at once by adding it to the layout (and thankfully there aren't too many layouts if we do want it to truly be on every page). To do this follow the steps below:
- Go to Manage > Master Layouts
- Select the template to add the component to. Basic is the layout used by most pages, and is probably the one you want here.
- Add the component to the layout. You may also want to add an additional row, or order the existing components on the layout to have your component show in the desired location.
- Once the layout is saved, you mush publish the changes
- Voila! Enjoy your new "global" component
Demo Time
I realise that this being a recording is cheating, but it's the closest I can get to a demo on a blog #ThatsMyExcuse.
You may have noticed that the banner doesn't show on the homepage. That's because the homepage doesn't use the "basic" layout, and instead uses the "no navigation" layout. If you want a component to show there, either add it to the "no navigation" layout, or just straight to the page.
#GoForIt
In conclusion, adding components to multiple pages in Content Hub doesn't have to be a laborious effort. By leveraging master layouts, you can add components across multiple Content Hub pages.