Using Pug Template Inheritance to Keep HTML Layouts DRY in Node.js
Learn how Pug’s extends and block keywords let you reuse a base layout, avoid duplicated markup, and safely evolve HTML templates in Node.js apps.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how Pug’s extends and block keywords let you reuse a base layout, avoid duplicated markup, and safely evolve HTML templates in Node.js apps.
When a field disappears from a ProcessWire page, the culprit is often inheritance or assignment. This guide walks you through the most common causes, how to verify each, and how to fix them so your templates render as expected.
Pug’s extends/block inheritance lets you define a single parent layout and override only the sections that differ per page — eliminating copy‑paste duplication while keeping asset injection composable via append/prepend.
Learn how to create reusable, decoupled page layouts in Contao 5 using Twig templates, block overrides, and the Page ‘Template’ field. A step‑by‑step example shows how to assign a custom template, verify it renders correctly, and avoid common pitfalls.
Learn how to build reusable page layouts in Express using Pug’s extends and block syntax. Follow a step‑by‑step guide to create a parent layout, override blocks, and verify the rendered output while handling caching and path issues.
Pug’s extends and block syntax enable reusable page layouts. This guide outlines the minimal design pattern, trust boundaries, operational checks, failure modes, and when to change the design. Use the example to verify correct block inheritance and avoid common pitfalls.
Learn how to diagnose and fix missing layouts in Eleventy, from front matter typos and case-sensitivity issues to directory data file overrides.
Learn how Pug’s extends and block keywords let you define a reusable layout and inject page‑specific content, reducing duplication in Node.js/Express apps.
Use ProcessWire’s template inheritance to avoid duplicated layout code. Build a base template, extend it with child templates, test the output, and learn the trade‑offs for clean, maintainable sites.