Get all pages for particular page types

1k views Asked by At

I'm using EPiServer 11 version with EPiServer.Find. I have a requirement to fetch all pages for landingPage type and standardPage types in one query.

Can you suggest if it is possible.

3

There are 3 answers

1
Asthiss On

The documentation uses searching for pages of specific type as an example so I would recommend reading that.

In your case you would just have to add both page types into the query

0
Ted Nyberg On

You could filter using MatchType or MatchTypeHierarchy.

0
user1641519 On

Thanks for suggestions. I managed to solve this as below.

var results = SearchClient.Instance.Search<PageData().FilterForVisitor().FilterOnCurrentSite()
                        .Filter(x => x.MatchType(typeof(LandingPage)) | x.MatchType(typeof(StandardPage)))
                        .GetContentResult();

Hope, it helps someone.