Dynamic Templates
Overview
You can control which template is displayed on your site (including your Community’s login and registration site), based on parameters included in the URL to the site. Separately, you can define criteria for the display of various templates once a user is authenticated to a Community, based on data stored in the Contact record or any records that that Contact relates to (i.e., looks up to; is a child or grandchild of).
For example, you can include in the URL for the login or registration page of your community a parameter that will select the Business School template; and you can alter the URL by including a different parameter that will select the Medical School template. So the same URL with different parameters can take users to the same page but with a different template, and the template can change the look and feel of the page, because the template can contain CSS.
Sites Templates Based on Parameters
- Click the Edit icon on a template
- Scroll to the bottom of the template configuration dialog. This is what you'll see:
- Here you can define a parameter (we’ve named the parameter “template” in the above example) and specify a value for the parameter (we’ve specified the value “sitesTemplate” in this example). In our example the Filter Logic is left to default to “AND” for all criteria, of which we have only one, but you can define more parameters and more complex criteria if you like.
- Save the template.
Now you can open your site page with the template by appending the parameter to the end
of your site’s login page URL like this:
https://pdtest3.secure.force.com/lead/apex/ERx_Forms__PageMaker?pageid=a0h41000002dlEVAAY&envid=a0g41000002lZdnAAE&id=&template=sitesTemplate
Community Templates Based on Criteria

In the illustration above we have specified that if the Contact’s active application’s Admissions Status = “Started App”, then use this template. You may use any number of criteria arranged in any valid logical expression to control the appearance of a template.
Sites Templates for Communities
In the above screenshot, the section at the bottom labeled “Display Criteria Main Template …” controls which template will be used for the Login, Registration, and Change Password pages of your Community. These pages are not authenticated pages; they are Sites pages; not Community pages. They therefore are controlled by criteria defined in terms of parameters, just like the example in the section above about Sites templates.