repeater -- where condition for template name or guid

emma zelewsky asked on February 18, 2016 18:55

Hi folks,

Is there a way to set the where condition in a repeater to the page template name (display name or code name) or the template guid, instead of the DocumentPageTemplateID?

The repeater is the universal viewer and lists documents based on the assigned template. The univiewer gets what we need using DocumentPageTemplateID = [int] But the template ID on the staging site is different on the production site, and I'd like the two to mirror each other.

Many thanks!

Recent Answers


Zach Perry answered on February 18, 2016 21:08 (last edited on December 10, 2019 02:30)

Have you tried {%CurrentDocument.DocumentPageTemplate.GUID|(identity)GlobalAdministrator%}?

0 votesVote for this answer Mark as a Correct answer

emma zelewsky answered on February 18, 2016 21:58

Thanks, Zachary. I wish I could, but...

The repeater is on a different page template (the home page) and grabs articles that are assigned a specific template, which is the only variable that differentiates those articles from other articles in the same folder.

I'm going to try a custom query to get the template code name and then use that in the univiewer w/ custom query webpart.

0 votesVote for this answer Mark as a Correct answer

Joshua Adams answered on February 19, 2016 16:28

Add a field onto your doc type that allows you to select the specific page that you want and store that pages guid, or instead of selecting the page in your field you can skip right to the template selection and store that.

0 votesVote for this answer Mark as a Correct answer

emma zelewsky answered on February 22, 2016 17:47 (last edited on December 10, 2019 02:30)

Thanks, Joshua. I was about to go that route by adding a label to the doc type, which got me thinking about getting the template info as a global object and that made me realize that was the piece I initially overlooked.

I wrote a macro for the where condition that grabs the template ID based on its name, and that solves the problem of the ID being different on the staging and production sites.

So the univiewer where condition states-- DocumentPageTemplateID = '{% GlobalObjects.PageTemplates.articles_splash_photo.ID |(identity)GlobalAdministrator%}'

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.