jbake-org / jbake-example-project-thymeleaf

Example project structure for JBake using Thymeleaf templates
MIT License
3 stars 14 forks source link

Simplify templates #3

Open pitpalme opened 9 years ago

pitpalme commented 9 years ago

Hello,

I'd like to simplify / optimize ThymeLeaf templates with respect to content.rootpath usage. There's a bunch of redundancy in "th:with" for setting the rootpath to use.

If no objections come up I'd like to create a patch an open a pull request.

What's the general opinion about this?

Thanks and regards, Peter

jonbullock commented 9 years ago

Hi Peter,

Absolutely fine with me.

msgilligan commented 9 years ago

There are also three templates (index.thymeleaf, archive.thymeleaf, tags.thymeleaf) where the th:with is not used, resulting in bad links like: nullarchive.html. I was going to submit a PR that added three more instances of:

th:with="rootpath=(${content.rootpath != null} ? ${content.rootpath} : '')"

in order to correct that.

@pitpalme Do you have a pull request to simplify that (by defaulting to '' elsewhere) or should I go ahead and submit an (easier for a JBake beginner) PR that just modified the three template files to contain the redundant code?

Update: In tags.html, rootpath needs to be defaulted to '../' to work correctly -- and there's an even worse problem with the includes. Looks like this really does need to be solved in the (Java?) code that initializes content.rootpath

jonbullock commented 9 years ago

Hi Sean the default value for rootpath should be ../ when rendering the tag files, that's set here: https://github.com/jbake-org/jbake/blob/master/src/main/java/org/jbake/app/Renderer.java#L233

Is this not the case?

msgilligan commented 9 years ago

I think my problem was caused by using version 2.4.0 of the bake command-line tool to initialize the project assets/templates/content, but configuring JBake 2.3.2 in my Gradle file. I created another project later using 2.4.0 consistently and did not have the problem.

ottlinger commented 7 years ago

@pitpalme any progress on the PR? I'd greatly appreciate a more up2date version of thymeleaf templates in the upcoming new release of jBake. Thanks