Hi everyone, I'm trying to get a list of page designer pages but had no luck yet. I saw that the dw.content.Content has a page field, that defines if it's a page or not. I was attempting to use the class dw/content/ContentSearchModel to search through content assets and get only the page designer pages. However I always get a count of zero, so none of these searches work.
const ContentSearchModel = require("dw/content/ContentSearchModel");
const apiContentSearchModel = new ContentSearchModel();
apiContentSearchModel.setRecursiveFolderSearch(true);
apiContentSearchModel.setFilteredByFolder(false);
apiContentSearchModel.search();
const contentSearchResultIterator = apiContentSearchModel.getContent();
const count = Number(apiContentSearchModel.getCount());
Using apiContentSearchModel.setFolderID() also doesn't work, even if the page designer page is assigned to that folder.
Is there a way to do this that works? Thanks in advance! #Page Designer@B2C Commerce Developers
Oh, just realizing there were more comments in this thread I didn't see in the first pass. Anyways, currently your only chance of page search is really through the search index. There is no separate functionality that realizes a search outside of the search index. The other option for retrieving pages I would think of would be to either place them into folders (so pick them up via folder traversal) or assign them to categories/products (you can do this for dynamic pages and afterswards retrieve them from categories/products again, see PageMgr.getPageByCategory() and PageMgr.getPageByProducts()).