Discussion:
[hakyll] How to insert a block of HTML in another page?
j***@gmail.com
2018-03-08 01:40:12 UTC
Permalink
I'm parsing a JSON file and using it to generate HTML, somewhat like in
this example:

https://groups.google.com/forum/#!topic/hakyll/LBYfdBc8eHU

The parsing and rendering to HTML String works, but I haven't been able to
insert it in a page. What's the proper way to do that? I found some old
code that looked like it might help:

https://groups.google.com/forum/#!msg/hakyll/8P4wHbAWChg/l5DrnG8xsQcJ
https://groups.google.com/forum/#!topic/hakyll/L5bRxkaHLH4

But many of the relevant functions (including setFieldPage from the first
example) have been removed.
This is roughly what I think I want to do:

* Match on index.html, which is the finished page except it has $features$
where I want the generated HTML to go
* Load and parse the json file somehow to featuresHtmlString
* Create a context: field "features" (return . featuresHtmlString) <>
defaultContext
* Treat the page as a template to apply in that context

Does that sound right? I also thought about starting with a blank page and
applying the index.html template to that, but couldn't figure out the
proper empty type to start from. I tried `const mempty`. I could write a
blank file but that feels like the wrong path to start down.
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...