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

create pages using multiple data files and one template #2

Closed
wants to merge 1 commit into from
Closed

create pages using multiple data files and one template #2

wants to merge 1 commit into from

Conversation

thasmin
Copy link

@thasmin thasmin commented Apr 24, 2012

Here is code describing the feature I requested in email. It's not integrated well and I don't expect this to be merged as-is, but it does demonstrate the effect I was going for. If you have a .mustache file in /templates, no corresponding .json file in contents, have a directory with the same name as the mustache template, and have .json files in that directory then this code will create one .html file in public// for each .json file in the the directory. So:
/templates/pages.mustache
/contents/pages/one.json
/contents/pages/two.json

will produce:

/public/pages/one.html
/public/pages/two.html

@collino
Copy link
Contributor

collino commented May 8, 2012

This would be a nice feature

@laktek laktek mentioned this pull request May 18, 2012
@laktek
Copy link
Owner

laktek commented Aug 27, 2012

Support for inheritable layouts was added in Punch 0.4.0 (which was released today).

If you create a layout named "_layout.mustache", it will be used to render contents that doesn't have its own layout.

As per the original example:

templates/_layout.mustache
/contents/one.json
/contents/pages/two.json

will produce:

/public/one.html
/public/pages/two.html

Also, if you define a layout in a sub-level that will be used to render the pages of cascading from that level:

So if we define a templates/pages/_layout.mustache, /contents/page/two.json will be rendered using that layout instead of templates/_layout.mustache.

Hope this would make things more flexible.

Thanks @thasmin for the original inspiration.

@laktek laktek closed this Aug 31, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants