Locator Tool - Query API limit query to folder.
I want to get all child pages with a particular content type in a folder.
I would assume there would be something like?
#foreach($x in $currentPage.parentFolder.children)
#if($x.contentType == "site:/mysite/Story")
<a href="$x.path">
<article class="list--item">
<h1>$!x.metadata.title</h1>
<p>$!x.metadata.description</p>
</article>
</a>
#end
#end
I know you use filter by content type using the Query
API:
#set($query = $_.query())
#set($query = $query.byContentType("site:/mysite/Story").publishableOnly(true).indexableOnly(true))
#set($pages = $query.execute())
#foreach($x in $pages)
<a href="$x.path">
<article class="list--item">
<h1>$!x.metadata.title</h1>
<p>$!x.metadata.description</p>
</article>
</a>
#end
Is there a way to restrict $_.query() to a folder or location?i.e.:
$query.searchLocation("site:/mysite/folder")
Or a way to inspect assets to determine content type?
i.e: $x.contentType = "site:/mysite/Story"
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Ryan Griffith on Jul 01, 2015 @ 01:10 PM
Hi,
Currently, there is no way to filter the results of the Query Tool by folder. We do have a related suggestion for this on our Idea Exchange. I highly recommend voting this up if you would like the feature to be considered for a future release of Cascade.
Also, the Page results from the Locator and Query tools will not provide you with the Content Type, only the Data Definition path..
I think you are on the right track though, where your best bet would be to use the Query tool to obtain all pages for a specific Content Type and while you are looping over the results, check the page's parent folder path to see if it is in the folder you want.
Please let me know if you have any questions.
Thanks!
Tim closed this discussion on Jul 17, 2015 @ 02:33 PM.