Sitecore Content Hub: Helpful Tips and Tricks - Part 1

Hi Sitecorians!👋 This blog is for everyone looking to make the most out of Sitecore Content Hub. Whether you're a beginner discovering its capabilities or a pro aiming to refine your workflows, this post is packed with essential tips and tricks to enhance your productivity. From integrating external components to managing translations, we’ve got practical insights to simplify and optimize your day-to-day tasks. Let’s get started with Part 1 of our series and explore how to unlock the full potential of this powerful platform. 


1. Translations in Sitecore Content Hub

Managing multilingual content is a critical requirement for many organizations. Content Hub offers robust translation capabilities to simplify this process.


Setting Up Translations:

  1. On the menu bar, click the Manage icon.
  2. Navigate to the Translations section.

  3. Click New Translation.

  4. In the Add Translation dialog:

    • Enter a unique identifier for the translation in the Translation Identifier field.

    • Add the source value in en-US.
    • Click Create to finalize the translation.
    • Once created, you can see the translation in the list. Sort the translations by the creation date to easily locate your newly created translation.

Adding Translations for Components:

  1. Open the component where you want to apply a translation (e.g., a button in a creation component).
  2. Go to the General section.

  3. For the Label type, choose Custom.
  4. In the Label field, either select an existing translation or add a new one:
    • Click the Add icon to create a new translation.

    • In the popup, select an existing identifier or create a new translation.
    • Enter en-US as the source value (e.g., Test Button).

    • Click Create.
    • When creating a new translation, note that Content Hub may prepend a _T__system. prefix to the identifier for system conventions. This prefix helps maintain unique identifiers in the system.


Tips for Smooth Translation:

Regularly Update Translation Mappings: If integrating with external systems like Microsoft D365, ensure that language code mappings are correctly configured and updated to maintain accurate translations
Implement Quality Assurance Processes: Establish a review process to verify the accuracy and cultural relevance of translations, especially when using automated translation services, to maintain content quality. 


2. Adding Your External Component to a Content Hub Page

Sitecore Content Hub allows you to extend its capabilities by integrating external components, providing flexibility for custom functionality. Here's how you can add an external component to a Content Hub page:


Steps to Add an External Component:

  1. Prepare Your Component:
    • Develop your custom component using a framework like React.
    • Ensure the component is compiled and ready for deployment (e.g., a minified JavaScript file).
  2. Upload the Component:
    • Navigate to the Portal Assets section in Content Hub.
    • Upload your component’s JavaScript file.

  3. Add the Component to a Page:
    • Go to Admin and navigate to the Pages section.

    • Open the page where you want to add your external component.

    • In the Page Layout section under the Main Zone, click Add Component.
    • In the modal popup, search for "External" and select the External checkbox.

    • Click Add to include the external component on your page.
  4. Configure the External Component:
    • In the component settings, set a title (e.g., "External") and toggle the Visible option to enable rendering.

    • Save the changes. You will now see the external component added to the Main Zone.


    • Add the JavaScript Bundle to the Component:
      • Click on the added component to open its configuration.

      • Select one of the following options to add your JavaScript bundle:
        • From Path: Provide the local path to your minified JavaScript file (e.g., your dist folder).

        • From Assets: Choose the minified JavaScript file from the Portal Assets section.

        • Type the file name (e.g., "userinfo") in the popup to search for and select your file.

        • Save the selection.

  5. Verify the Added File:
    • The selected JavaScript file will now appear in the component settings.

    • Clicking on the file will take you to its Portal Asset Details page, where you can view additional details.
    • You can also create a public link for the file and use it in the From Path option, providing functionality similar to using a local path.



Quick Tip:

Always test your component with both local paths and public links to ensure proper functionality. Public links work across environments, while local paths are user-specific.


3. Custom CSS on Pages: Why and How?

You can use the CSS tab in Sitecore Content Hub to apply custom style overrides to a page using cascading stylesheet (CSS) syntax. While this can be useful for tailoring the interface, it’s important to follow best practices to avoid potential issues during system upgrades.


How to Apply Custom CSS:

  1. On the menu bar, click the Manage icon.
  2. Navigate to Pages under the Manage section.

  3. Select the page you want to modify from the left pane (e.g. MarketingCampaigns).
  4. Here’s how the current page looks without any CSS applied. 

  5. Click the CSS tab and then click Edit.

  6. In the code field, enter your custom CSS rules. For example: I want to change the background color of a button.

  7. Click Save.
  8. Refresh the page to see your changes.

Important Notes:

  • Use data- attributes or specific classes provided by Content Hub (e.g., [data-style-name='largeIconWrapper']) to target elements safely.
  • Avoid overriding classes from third-party libraries or Material UI (e.g., .MuiTab-root), as these may change during updates.

CSS Classes to Avoid:


Why Move to Themes?

For long-term scalability, migrate custom CSS to themes:

  • Themes provide a centralized way to manage styles across pages.
  • They ensure consistency and make it easier to update styles in the future.

Pro Tips:

  • Use the History option to track and review CSS changes.
  • Avoid including private or sensitive data in CSS customizations as they are visible in page source.


4. Shared Pools vs. Page-Specific Pools

Selection pools in Sitecore Content Hub play a vital role in caching selected items, ensuring seamless navigation and interaction between Search components. Here’s an overview of how they work and their capabilities:


How Selection Pools Work

  • Selection pools store the items selected by users while interacting with a Search component.
  • They enable caching of selections, so users can navigate across pages or components without losing their previously selected items.

Shared Pools

  • Purpose: Shared pools allow multiple Search components to share the same pool of selected items.
  • Use Case: Ideal when you want consistency across pages or components using the same selection criteria.
  • Configuration: On the Selection tab, select the Shared pool option and choose the desired pool from the list. These pools are managed centrally and can be reused across different pages or components.

Page-Specific Pools

  • Purpose: Page-specific pools are unique to a single Search component and are used exclusively within the page where they are configured.
  • Use Case: Best for scenarios where the selected items are specific to a particular page or context.
  • Configuration: On the Selection tab, select the Page-specific option and choose or create a pool that is limited to the current page’s context.

Key Differences


By selecting the right pool type for your use case, you can ensure efficient data selection and improve the usability of your Search components.


Configuring Selection Pools:

  1. Add a Search component to the page where you want to use selection pools.
  2. On the Layout tab, click the page component to open its details page.
  3. Navigate to the Functionality tab and turn on the Selection switch.

  4. Choose from:
    • Shared Pools for selections shared across pages.
    • Page-Specific Pools for selections tied to a specific page.
  5. Optionally, create a new pool by entering a unique name.







Best Practices for Selection Pools

  • Use shared pools to maintain user selections across multiple pages or components, ensuring a cohesive experience.
  • Opt for page-specific pools when selections are context-sensitive and should not impact other components or pages.

By understanding the caching behavior and configuration options for selection pools, you can provide users with an efficient and intuitive way to manage their selections across Sitecore Content Hub.

Conclusion 

Thank you for exploring these practical tips and tricks for Sitecore Content Hub!😊 We hope this guide empowers you to enhance your workflows and make the most out of this powerful platform. Stay tuned for Part 2, where we'll dive into advanced features and strategies. If you found this helpful, feel free to share your thoughts or questions in the comments. Happy exploring!😊👋

Post a Comment (0)
Previous Post Next Post