Search code examples
modxmodx-evolutionwayfinder

Wayfinder IncludeDocs parameter in Modx is breaking the snippet


I'm quite stuck on an unexpected problem. I'm trying to use Wayfinder to generate a sitemap for a project. The output of the navigation items is as expected, but I need to include a number of documents in addition to the primary navigation elements.

To do this, I have used the includeDocs parameter.

[[Wayfinder? &startId=`0` &includeDocs=`17,18,19,20`]]

When I do this, I get no output at all. Remove includeDocs and I get the standard nav (expected). Use the param and the output is completely empty.

No idea what I'm doing wrong or what (if any) other setting must be defined in order to make this work.


Solution

  • The includeDocs parameter is very misleading. It should rather be named "onlyIncudeDocs" or "restrictTo", since that is what it does. It also requires the docs you include to be directly accessable from your startId, alternatively have the entire path "included".

    I would suggest you create weblink resources directly under your startId, and link them to the resources you want to include. That way wayfinder will pick them up by default. (Note that you may need to handle this in your rowTpl for wayfinder, since a weblink stores the actual link in it's content field)

    If you also want to include the children of the id's you specify, you would probably be better of slightly revising your resource structure.