Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Output of combined JSON files #29

Open
pdlug opened this issue Sep 29, 2012 · 1 comment
Open

Output of combined JSON files #29

pdlug opened this issue Sep 29, 2012 · 1 comment

Comments

@pdlug
Copy link

pdlug commented Sep 29, 2012

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>"
}
@laktek
Copy link
Owner

laktek commented Oct 1, 2012

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants