How to use pagetrees with multiple output targets? #82

Closed
opened 3 years ago by clarityflowers · 2 comments
clarityflowers commented 3 years ago (Migrated from github.com)

So, pagetrees as they are set up ask you to list your pages as the final output name:

#lang pollen

chapter-1.html
chapter-2.html

But, I have multiple output targets (in my case, html and gemtext), so I don't know if it's going to be .html or .gmi until render time. I've spend a few hours hacking at this trying to get something working, but I'm really wondering if there's something obvious I'm missing.

So, pagetrees as they are set up ask you to list your pages as the final output name: ``` #lang pollen chapter-1.html chapter-2.html ``` But, I have multiple output targets (in my case, html and [gemtext](https://gemini.circumlunar.space/)), so I don't know if it's going to be `.html` or `.gmi` until render time. I've spend a few hours hacking at this trying to get something working, but I'm really wondering if there's something obvious I'm missing.
mbutterick commented 3 years ago (Migrated from github.com)

The pagetree can contain functions that generate its content, like any other Pollen file. (Indeed, it doesn’t even need to be written in #lang pollen, if you find #lang racket easier for the purpose.

You could set up the pagetree so that all the extensions are change to html or gmi based on the current-poly-target.

Or going the other direction — you could make two pagetrees, one for html and one for gmi, that are derived from a common set of source names.

This set of source names could either be manually updated, or automatically generated.

The pagetree can contain functions that generate its content, like any other Pollen file. (Indeed, it doesn’t even need to be written in `#lang pollen`, if you find `#lang racket` easier for the purpose. You could set up the pagetree so that all the extensions are change to `html` or `gmi` based on the [`current-poly-target`](https://docs.racket-lang.org/pollen/Setup.html?q=current-poly-target#%28def._%28%28lib._pollen%2Fsetup..rkt%29._current-poly-target%29%29). Or going the other direction — you could make two pagetrees, one for `html` and one for `gmi`, that are derived from a common set of source names. This set of source names could either be manually updated, or automatically generated.
clarityflowers commented 3 years ago (Migrated from github.com)

I see, that's where basically where I ended up, but I wanted to make sure there wasn't something simpler. Thank you!

I see, that's where basically where I ended up, but I wanted to make sure there wasn't something simpler. Thank you!
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen-users#82
Loading…
There is no content yet.