how can I have few different #nested elements in macros?
You cant have different #nested elements in a macro, every usage of it will output the same text.
If you goal it to have multiple variable sections in your macro, you can use the #assign element.
Example of a page #macro allowing to define the body, header and footer content :
<#macro pageTemplate header="" footer="">
${header}
<#nested >
${footer}
</#macro>
You can then define each section using the #assign element (but admittedly having multiple named #nested element would be better).
<#assign headerContent>
This is the header.
</#assign>
<#assign footerContent>
This is the footer.
</#assign>
<@pageTemplate header=headerContent footer=footerContent>
This is the nested content.
</@pageTemplate>
The resulting output will be :
This is the header.
This is the nested content.
This is the footer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With