# Web template system
|  | A **Web template system** in web publishing allows web designers and developers work with web templates to automatically generate custom web pages, such as the results from a search. This reuses static web page elements while defining dynamic elements based on web request parameters. Web templates support static content, providing basic structure and appearance. Developers can implement templates from content management systems, web application frameworks, and HTML editors. |
| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| | wikipedia:: [Web template system](https://en.wikipedia.org/wiki/Web_template_system) |
| | [Template processor - Wikipedia](https://en.wikipedia.org/wiki/Template_processor) |
| | [JavaScript templating - Wikipedia](https://en.wikipedia.org/wiki/JavaScript_templating) |
Typically for rendering on the server and returning regular html to the browser
Types
- Server-side – run-time substitution happens on the web server
- Client-side – run-time substitution happens in the web browser
- Edge-side – run-time substitution happens on a proxy between web server and browser
- Outside server – static web pages are produced offline and uploaded to the web server; no run-time substitution
- Distributed – run-time substitution happens on multiple servers
Keep in mind [[Emmet]] as a potential good enough solution that might obviate introducing the complexity of a templating system
[[Static Site Generators (SSG)]]s
## “fragments”
- aka partials
- Modular snippets for reuse and inclusion in templates, e.g. the fragments in Thymeleaf. Aka partials
## Systems/Engines
- [[Mustache template system]]
- Mustache works on 30+ languages
- I did that build generic xml thing for [[Lending Standard]] with Mustache
### [[Microsoft stack]]
- [[ASP.NET Core Razor Pages]]
### [[Python]]
- [[Jinja]]
- [[Django]] Has a template system
- [[Web2py]] Has a template system
### [[Java]]
- [[Thymeleaf]]
## [[JavaScript]]
- EJS
- Embedded JavaScript
- npm install express-ejs-layouts
- layouts = require(”express-ejs-layouts”); app.use(layouts);
- Used as a middleware
- Nunjucks
- https://mozilla.github.io/nunjucks/
- Very similar to, and very inspired by [[Jinja]]
- Handlebars
- http://handlebarsjs.com/
- Pug
- https://pugjs.org/api/getting-started.html
- [[Knockout]]
- Has a templating system
- [[Angular]]
- Has a template system
- [[Ember.js]]
- Has a template system
- Backbone.js
- Has a template system
- [[Vue.js]]
- Has a template system
### [[Ruby]]
- Liquid
- by Shopify
- Written in Ruby