Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect
Advanced tools
A dialect for Thymeleaf that allows you to use layout/decorator templates to style your content.
A dialect for Thymeleaf that lets you build layouts and reusable templates in order to improve code reuse.
All of the latest documentation on the layout dialect can be found on the dedicated docs website at https://ultraq.github.io/thymeleaf-layout-dialect/
For version 1 docs which supported Thymeleaf 2, the classic readme still exists over on https://github.com/ultraq/thymeleaf-layout-dialect/tree/1.4.0
The Thymeleaf Layout Dialect adds the ability to decorate templates -
automatically for the <head>
section of an HTML template, and explicitly
through extension points that developers can add to their templates. This all
adds up to create layouts that can be extended in a manner similar to classical
inheritence.
For example, given a common layout.html
file, set some shared static assets in
the <head>
and define extension points in the body with the layout:fragment
processor:
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
<head>
<title>Layout page</title>
<script src="common-script.js"></script>
</head>
<body>
<header>
<h1>My website</h1>
</header>
<section layout:fragment="content">
<p>Page content goes here</p>
</section>
</body>
</html>
Create a content template that will define its own title, static resources, and
replacements for those extension points. Link the page to the layout by using
the layout:decorate
processor at the root element of the page which will
instruct Thymeleaf to decorate the layout with this template:
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout.html}">
<head>
<title>Content page</title>
<script src="content-script.js"></script>
</head>
<body>
<section layout:fragment="content">
<p>This is a paragraph from the content page</p>
</section>
</body>
</html>
When Thymeleaf processes your content template, the resulting HTML will be:
<!DOCTYPE html>
<html>
<head>
<title>Content page</title>
<script src="common-script.js"></script>
<script src="content-script.js"></script>
</head>
<body>
<header>
<h1>My website</h1>
</header>
<section>
<p>This is a paragraph from the content page</p>
</section>
</body>
</html>
Check out the getting started guide to learn how to add the layout dialect to your Thymeleaf project, or read up on the many processors for more ways of how the layout dialect can help you build your templates.
FAQs
A dialect for Thymeleaf that allows you to use layout/decorator templates to style your content.
We found that nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.