It's great to see a Freemarker release
and talk about supporting LocalDate (FREEMARKER-35) some day.
Is there been any work towards *layout inheritance*?
For example, for JBake, presume we have a *base.ftl* like this:
<html>
<head>
<script>... Google Analytics id=${analyticsId}</script>
</head>
<body>
<#include "shared/menu.ftl"/>
<#nested/>
</body>
</html>
and then 2 ftl files that extend that layout:
1) *about-us**.ftl* - which outputs about-us.html
<#layout "base.ftl">
<h1>About us</h1>
...
</#layout>
2) *event-list.ftl* - which outputs event-list.html
<#layout "base.ftl">
<h1>Event list</h1>
<#list ...>...</#list>
</#layout>
Passing parameters to the layout would be nice too.
For example the page title from about-us.ftl and event-list.ftl to base.ftl.
Here's a dirty hack that does all this, using macros and tricks, but
it's extremely brittle:
- base:
https://github.com/kiegroup/optaplanner-website/blob/main/optaplanner-website-root/templates/base.ftl#L1
- normalBase extends base:
https://github.com/kiegroup/optaplanner-website/blob/main/optaplanner-website-root/templates/normalBase.ftl#L6
- team extends normalBase:
https://github.com/kiegroup/optaplanner-website/blob/main/optaplanner-website-root/templates/_content_community_team.ftl
--
With kind regards,
Geoffrey De Smet