Quick Tip: Blazing Fast List of MODX Resources

Oct 14, 2016

Building on the GoogleSiteMap code, written by @garryn here at MODX ( more details here ) this Snippet returns a collection of HTML list items, each containing a link to a Resource that meets the criteria passed to the Snippet.

Limitations

  • You can't template the output—only the wrapper.
  • You can only specify a single parent, from which only direct children will be listed. Otherwise all Resources will be listed.
  • You can optionally specify a Context from which to fetch Resources.
  • You can specify criteria like showUnpublished, showHidden, etc.

That said, when you want to render a list of thousands of MODX Resources, this Snippet is ridiculously fast and lean on server resources to execute.