You can enhance your website’s flexibility by using shortcodes within Page Builder. This allows you to dynamically insert page-specific data into custom code, making integrations and customizations more efficient.
What Are Shortcodes?
Shortcodes are dynamic placeholders that automatically fetch and display relevant data based on the page being viewed. Instead of adding static values, you can use these variables to ensure your code adapts to different contexts.
Available Shortcodes
You can use the following shortcodes in your custom code:
- Page Type
Identifies the type of page (e.g., story page, section page, tag page, homepage). - Story ID
Returns the Story ID from the CMS.
Note: Available only on story pages. For other pages, this will return null. - Story Slug
Returns the URL slug of the story. - Story Type
Returns the type or category of the story - Primary Section
Displays the main section associated with the page. - Sections
Returns all sections linked to the content. - Sections Name
Returns the names of the sections. - Sections Display Name
Returns the display names of the sections. - Authors ID
Returns the ID(s) of the author(s). - Authors
Returns the name(s) of the author(s).
How to Add Custom Code with Shortcodes
You can include these shortcodes while adding custom code in Page Builder:
- Log in to Page Builder
- Go to General Settings
- Click on Manage → Insert Custom Code
- Click on “Click Here to Insert”
- Add your custom code along with the required shortcodes
Choose where the code should be applied: All pages, or Specific templates - Save and publish the changes
Why Use Shortcodes?
- Dynamically adjust content based on page context
- Simplify integrations with third-party tools
- Avoid hardcoding values
- Improve scalability and maintainability
This feature gives you more control over how your integrations and custom scripts behave, helping you create more dynamic and context-aware experiences across your website.
