Power Pages: Use Content Snippets to Replace Hard-Coded Content

Dominic Liu
1 min readJan 18, 2024

--

To prevent hard-coded content on your portal, use the Content Snippet feature allows easy management of all saved content, providing a pleasant experience for Portal Admins when updating any information.

First, create a new Content Snippet by assigning it a name and selecting your website record. Personally, I select ‘Text’ as the Type for my content snippet, but you can also choose to use ‘HTML’.

Second, insert the content snippet into your web page. You can either directly add it to the Web Template via Liquid:

<p>{{ snippets['mag_Test_Helper_Text'] }}</p>

or place it anywhere on your form using jQuery:

var helperText = `{{snippets["mag_Test_Helper_Text"]}}`;
//Add helperText above the table
$(helperText).insertBefore("table[data-name='mag_myCustomTableName']");

To sum up, Content Snippet in Power Pages streamline content management, offering a centralized, easily updatable source. This improves efficiency, consistency, and supports content reuse and localization. Enhanced version control, streamlined collaboration, and the ability to include dynamic content contribute to a more organized and scalable development process, simplifying maintenance and troubleshooting.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Dominic Liu
Dominic Liu

Written by Dominic Liu

Power Pages Developer | Dynamics 365 Developer

No responses yet

Write a response