New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rendering custom properties from jbake.properties into Thymeleaf or markdown templates #326
Comments
Hi. You can reference configurations with |
Thanks @ancho, after changing the template to:
the baking does not work and yields:
Any ideas? |
Hmm....have you tried to rename the property to foo.version in jbake.properties? |
@ancho the references get resolved in markdown and asciidoc, only Thymeleaf seems to be problematic :-( That's why I thought I need to set an "enabling" property in jbake.properties for Thymeleaf, but did not find any. BTW: Changing the property to
|
Ahh. Ok. I didn't get that. Sorry. |
@ancho I rechecked my repository:
while markdown and thymeleaf do neither work with/out the configuration prefix. Is there a config option I missed? Thanks. |
@ottlinger have you updated your project to jbake 2.5.0? notice that the version of thymeleaf is 3.0.2. According to the documentation http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#more-on-texts-and-variables you need to access variables with a tag attribute like I tried it with the following tag in a thymeleaf footer template like:
Set Compare your templates to the example project https://github.com/jbake-org/jbake-example-project-thymeleaf. I hope that helps. |
@ancho Thanks for your help, again - I thought to have tried this option before, maybe ran into caching issues. The prefix Is there a simple/same way to do this in markdown? Neither prefix nor maven syntax with dollar seems to work. All I see is the version placeholder in my generated md file. |
I don't think so. The MarkdownEngine doesn't seem to handle variables. As pegdown has a big fat deprecation notice we should change it anyways.... |
ok - can't be helped at the moment. At least Asciidoc and Thymeleaf work properly. I'm going to raise a PR updating the documentation to make this more clear. @ancho thanks for figuring this out. |
Nice. Thank you. I opened an issue to evaluate a new markdown parser. See #327 |
Looks like @acho has solved the initial query - thanks for that :) To clarify properties in the configuration are made available to all of the template engines via the |
I'd like to render my own properties into thymeleaf template files (the variable is correctly injected into asciidoc documents but does not work in thymeleaf template files)
Example
My jbake.properties contains:
and my menu.thyme tries to reference this in a menu item header:
but is rendered as
What do I do wrong? Is that a missing feature in jbake 2.5.0 or do I have to add another configuration optional to allow parsing self-defined variables?
BTW: I can easily reference
in Markdown and Asciidoc files and the variable is substituted as expected.
Thanks for any hint
The text was updated successfully, but these errors were encountered: