> On Feb 28, 2019, at 3:17 PM, Brendan Stromberger 
> <brendanstromber...@gmail.com> wrote:
> 
> In my template, I have `◊(define here (path->pagenode (->output-path 
> (hash-ref metas 'here-path))))`
> 
> This renders out to a pagenode that looks something like 
> "body/3_the_trigrams.html"
> 
> When I send this pagenode into `next` or `previous`, it returns nothing.

Probably you want to do something like this (pseudocodishly, I have not checked 
that this works):

;;;

(define here-path (hash-ref metas 'here-path))
;; `here-path` is an absolute path, so if your pagetree nodes are relative to 
project root,
;; you'll also want to make this one relative the same way.
(require racket/path) ; for `find-relative-path`. 
(define here-path-relative (find-relative-path here-path 
(current-project-root)))
;; every node in a pagetree is a symbol
(define here-path-pagenode (string->symbol (path->string here-path-relative)))
;; having made our special pagenode, now we can query the pagetree
(define next-path-pagenode (next here-path-pagenode)) 
;; then we convert the result back to an output path
(define next-url (->output-path (build-path (current-project-root) 
next-path-pagenode)))

;;;

BTW if the code above lives inside a template, use `local-require` rather than 
`require`. But I would put the code inside a function in "pollen.rkt". In that 
case you can pass `metas` as an argument, or use the `current-metas` parameter.

-- 
You received this message because you are subscribed to the Google Groups 
"Pollen" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pollenpub+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to