Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Output of combined JSON files #29

Open
pdlug opened this Issue · 1 comment

2 participants

Paul Dlug Lakshan Perera
Paul Dlug

Feature request/discussion topic: I have a structure like the one below for each post, basically a JSON file with some metadata and a summary and body of the post in markdown. This is working great in that I'm able to write templates that put it all together nicely. I'm doing some client side rendering and would like to have the generate process output a JSON file for each post that combines the JSON that is there now with the transformed markdown included in it. This would enable the client side javascript to render or conditionally render the HTML. Example use case is in a small screen device show only summaries but in a large screen show full bodies of posts.

Any thoughts on supporting this case? Is it possible to hook into the generation process in a easy way to make this possible?

| -- contents
|    | -- posts
|    |     | -- hello-word.json
|    |     | -- _hello-world
|    |     |    | -- summary.markdown
|    |     |    | -- body.markdown

Example JSON:

{
  "title": "Hello World",
  "thumbnail_image": "/assets/images/hello-world.png"
}

Example combined JSON:

{
  "title": "Hello World",
  "thumbnail_image": "/assets/images/hello-world.png",
  "summary": "<p>This is a great article</p>",
  "body": "<p>This was in a markdown file, it is now HTML</p>"
}
Lakshan Perera
Owner

The negotiateContent function of the ContentHandler do actually provide an output as you suggest. That's what the renderer uses to when rendering pages.

I'm currently looking into exposing the functions of TempalteHandler and ContentHandler via a HTTP API. So they can also be used for client-side rendering as you suggest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.