Try our conversational search powered by Generative AI!

Find a page by page type

Vote:
 

Is there some way I can find pages that use a specific page type?


I need to debug a specific page type but I can't find/don't know which pages that use it.

#74483
Aug 29, 2013 10:01
Vote:
 

If you just need a list of the pages using a certain pagetype you could use the oldest trick in the book:

1. BE SURE that at least one page in your pagetree uses that pagetype. (create a new page somewhere if you're not sure)

2. Go to admin mode > pagetypes tab > your pagetype

3. Try to delete the pagetype.

You'll get an error saying there are existing pages using that pagetype, and the pages will be listed for you.

 

If you need to find the pages in code you could go for a FindPagesWithCriteria approach with PageTypeId as the critera:

PropertyCriteriaCollection criterias = new PropertyCriteriaCollection();

PropertyCriteria criteria = new PropertyCriteria();
criteria.Condition = CompareCondition.Equal;
criteria.Name = "PageTypeID";
criteria.Type = PropertyDataType.PageType;
criteria.Value = PageType.Load("PageTypeNewsItem").ID.ToString(); // PTB: check out PageTypeResolver
criteria.Required = true;
criterias.Add(criteria);

PageDataCollection pages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias);

    

#75492
Edited, Sep 26, 2013 23:44
Vote:
 

The PageTypeUtil module on EPiCode (https://www.coderesort.com/p/epicode/wiki/EPiPageTypeUtil/About) also gives you the option to list pages of a certain pagetype.

#75501
Sep 27, 2013 8:46
Vote:
 

Thanks Arild for your replies.

#75509
Sep 27, 2013 9:58
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.