How to have content available in datamodel but not rendered in a "dedicated" page

27 views
Skip to first unread message

paolovpro...@gmail.com

unread,
Aug 18, 2018, 9:54:57 AM8/18/18
to JBake Users
Actually if you define a custom type every data file tagged with that type will be available on the data model and will mandatorily produce a rendered page.
I want to have the data available on the data model to use in another page and not a page rendered for that specific type.

For instance I've created a "news" type. Every time I update my site I create a new file (for instance news20180824.md) and on its metadata I put type=news.
Then I want in my index page to have all the news and I don't want to produce a single page for every news file.

I've "hacked" jbake to do this putting this line:

if ("none".equals(findTemplateName(docType))) return;

as the second line in "Renderer.render(Map<String, Object> content) throws Exception" and setting:

template.news.file=none

in jbake.properties.

It's a dirty hack but I think the need I have could be common to others.
Probably would be better to have that no template defined for a type means no rendering but the template definition id mandatory to have the data on the data model and not copied as is on the output.

I'd like a comment, at least at my request. Could be there is already a way to do it that I've overlooked.

Thanks

Jonathan Bullock

unread,
Nov 11, 2018, 4:58:42 PM11/11/18
to paolovpro...@gmail.com, jbake...@googlegroups.com
Hi,

Apologies for the delay in responding to this.

No there isn't another way to achieve this at present. My first thought was to have a flag in the metadata header that controls whether the content is output to a file or not, but maybe it would be best to have a special type defined in JBake to achieve this goal.

Could you raise an issue for this on GitHub?

Thanks,
Jon

--
You received this message because you are subscribed to the Google Groups "JBake Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jbake-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages