Stop base assets from showing up in the Query API queries

kendjone's Avatar


09 Dec, 2015 03:27 PM

I am having a reoccurring issue of having to manually remove base assets used for factories from queries that use $_.query.byContentType("MyType")

Does anyone know a way to make base assets not show up when using the Query API?

  1. 1 Posted by Eric L. Epps on 09 Dec, 2015 04:48 PM

    Eric L. Epps's Avatar

    The only way I know of is to somehow filter them out while processing the loop. For instance, if the path contains your base asset folder.

    #if(! $page.path.contains('-defaults') )
        <div>do something</div>

    You might also be able to get around by keeping your base assets in a separate site and limiting the query to just one site.

  2. 2 Posted by Eric L. Epps on 09 Dec, 2015 04:57 PM

    Eric L. Epps's Avatar

    After looking at my code to refresh my memory, the separate site solution is what I'm using and it works.

  3. 3 Posted by Ryan Griffith on 10 Dec, 2015 06:33 PM

    Ryan Griffith's Avatar


    Eric's solutions are definitely the way to go at this point.

    Just wanted to plug there is a related suggestion on our Idea Exchange to add additional filtering capabilities to the Query API. A possible addition to this suggestion could be to filter on the asset name using a wildcard-like syntax.

    If you have not already, I highly recommend voting for this suggestion if you would like to see it implemented in a future release.


  4. Ryan Griffith closed this discussion on 22 Dec, 2015 08:21 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? 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