Store source content by using web templates
Web Template is a Dynamics 365 for Customer Engagement entity (adx_webtemplate), included with Dynamics 365 for Customer Engagement portals, that is used to store template source content. A web template will generally contain Liquid for dynamic content rendering and is the central entity used to integrate Liquid templates with the rest of the Dynamics 365 for Customer Engagement portals system.
Web Templates can be included in other content or combined with other templates by using template tags, and are referenced in these tags by their Name attribute. They can also be used to create entire custom Page Templates, or create custom headers and footers for your portal website.
Web template attributes
|Name||The name of the template. Used to reference this template when it is included in other content, or extended by other templates.|
|Source||The source content of the template. In Dynamics 365 for Customer Engagement, a source code editor with syntax highlighting and other code editing features is provided for this field.|
|MIME Type||Optionally provides a MIME type for the content of the template. If none is provided, a type of text/html is assumed. This value will only be used in cases where the template is associated with a Page Template, and controls the rendering of all content for that template.|
Web templates as page templates
Web Templates can be used in conjunction with page templates to create new templates for the Dynamics 365 for Customer Engagement portals content management system. This can be done entirely within Dynamics 365 for Customer Engagement, without the need to write .NET code or redeploy your portal application.
To create a new page template based on a web template, select a Type of Web Template when creating a new Page Template record. Then select a Web Template.
Note the option Use Website Header and Footer (which is checked by default). If this is checked, your Web Template will control rendering of all page content between the global website header and footer. If this option is unchecked, your Web Template will be responsible for rendering the entire response in the case that you're rendering HTML, this means everything from the doctype to the root <html> tags, and everything in between.
While the most common use cases for Web Templates will be to render HTML, rendering the entire response (by deselecting Use Website Header and Footer) gives you the option of rendering any text-based format you choose. This is where the MIME Type attribute of Web Template becomes relevant. When a Page Template that does not use the website header and footer is rendered, the HTTP response Content-Type header will be set to the MIME Type of the associated Web Template. (text/html will be used if no MIME Type is provided.) This gives you a wide variety of options for rendering non-HTML content by using Liquid. A common use case would be to render an RSS feed, by setting a MIME Type of application/rss+xml.
Web templates as website headers and footers
Web templates can also be used to override the global header and footer used by a Dynamics 365 for Customer Engagement portal. To do this, set the Header Template or Footer Template field of your website to the web template of your choice. Note that if you override Website Header, your selected template assumes responsibility for rendering the primary navigation, sign-in/sign-out links, search interface, and so on for your site interface elements that are normally handled by the default header template.
Built-in web templates
There is a set of premade Liquid templates available within Dynamics 365 for Customer Engagement portals. To use them, you must include them by name, using the list below as a reference.
|Ad||This template renders an ad by name, or a random ad from an ad placement.||
|Blogs||This template renders recent blog posts in a list group.||
|Breadcrumbs||This template renders links of ancestor pages back to the Home page from the current page.||
|Child Link List Group||This template renders links to any child pages of the current page in a list group.||
|Events: Upcoming||This template renders links to events that occur between now and 60 days from now.||
|Forums||This template renders a list of the website's forums with their respective number of threads and posts.||
|Layout 1 Column||This template renders a single column layout containing breadcrumbs, page title, and page copy content.||
|Layout 2 Column Wide Left||This template renders a two column layout. The left column is wider than the right. It contains breadcrumbs, page title at the top of the page and the page copy content is located in the left column.||
|Layout 2 Column Wide Right||This template renders a two column layout. The right column is wider than the left. It contains breadcrumbs, page title at the top of the page and the page copy content is located in the right column.||
|Layout 3 Column Wide Middle||This template renders a three column layout. The middle column is wider than the left and right. The layout contains breadcrumbs and the page title at the top of the page and the page copy content is located in the middle column.||
|Page Copy||This template renders the editable page copy content HTML with support for embedded Liquid.||
|Page Header||This template renders the page title.||
|Poll||This template renders a poll by name, or a random poll from a poll placement.||
|Search||This template renders a basic search form with a single text input and search button.||
|Side Navigation||This template renders a vertical tree view style navigation. It has links to ancestor pages back to the first level (or specified depth offset), links to sibling pages of the current page, and links to children of the current page.||
|Snippet||This template renders an editable HTML content snippet by name.||
|Top Navigation||This template renders an editable nav bar with drop-down menus for the Primary Navigation web link set.||
|Weblink List Group||This template renders a list group of links for a web link set.||
Add dynamic content and create custom templates
Understand Liquid operators
Create advanced templates for portals Enable header and footer output caching on a portal
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.