So, I'm very much on board with the incremental formalization way of working, and I've been using it for a while now.
However, I want to step it up a little, and I'm unable to figure out how to get the result I'm looking for.
What I have:
- various pages tagged "person", describing, you guessed it, persons.
- a person may belong to an organisation (which gets its own page, so far I'm still 100% following the guide)
- a person may belong to one or more teams (which in turn may belong to an organisation)
- teams and organisations are listed as links to the relevant pages, just like in the guide.
For now, I'm hand-rolling queries for each team and organisation page to list all people within that team or organisation. The system works, in that I can click around and view graphs and everyone who sees it is suitably impressed. However, manually adding stuff to pages doesn't scale that well, so I wanted to make things better with templates. I envisioned having this team template, that automatically adds the correct snippet of query magic to populate it with people, and an organisation template to do the same for organisations.
What I can't figure out, however, is how to get that query into the template, and actually working in the resulting page. In fact, I can't even get it to work outside a template. If I add this snippet:
${query[[
from p = index.contentPages("person")
where (table.includes(p.teams, "[[${editor.getCurrentPage()}]]"))
select templates.pageItem(p)
]]}
...I get an emptly list. If I replace the editor.getCurrentPage() bit with a string like "[[Team/MyAwesomeTeam]]", it'll work.
So I think step one is figuring out how to have the query contain the dynamic bit to look up. Next step would be encoding that in a template, but I think using the ${"$"}{query...} syntax should do the trick there, as described in this thread.
Can anyone help me, or point me towards the bit of documentation I might've missed? Will this work at all, or should I look into widgets or whatnot?