How should I make a pagetree with poly sources?
#23
Closed
opened 4 years ago by oldmankit
·
4 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Do pagetrees only work with one output source?
Let's say I'm using poly sources (1.poly.pm and 2.poly.pm) to generate both html and txt output. If my pagetree contains:
then Pollen functions which rely on the pagetree (for example,
previous here
) work only when generating html output. The txt output seems to be unaware that there is any pagetree. So previous, next, parent and children links don't produce anything.I tried making a pagetree with:
But that didn't fix it. None of the pagetree-depenent functions worked for either html or for txt.
So you want two pagetrees that are the same, except the file extension for each pagenode is
txt
rather thanhtml
?Yes, that's exactly right.
I suppose I’d write the pagetree using
poly
extensions and then pass the tree through a tag function that converts tnem. Here’s one approach:(Taking the shortcut here of using string-manipulation functions on path-like things, which is not the most enviable practice but it shortens the example)
Thank you so much, @mbutterick That works perfectly.
I had a little flash of insight when I saw what you'd done: truly everything is programmable, even the .ptree which I was thinking of as a kind of black box.