Clipped moustache. Include header and footer in a Mustache template

A template for creating web pages is great if you want to integrate front- and backend easy. I have been using Mustache for a while and I'm quite satisfied. It works great with both Dropwizard and Spark Mustache for.

The documentation says how to include a snippet from another template. But searching for it was not that easy.

The problem I would like to solve is to reuse the same header and footer on many web pages. That is, include a snippet from another template into a template.

The solution is to refer to a another template from a template using

<!DOCTYPE HTML> <html> <head> <link href="" rel="stylesheet"> </head> <body>

How to grow big mustache

<script src=""></script> <script src=""></script> </body> </html>

The result is a web page like this:

<!DOCTYPE HTML> <html> <head> <link href="" rel="stylesheet"> </head> <body> <p>Page content</p> <script src=""></script> <script src=""></script> </body> </html>

This solves my problem with the same header and footer on each page using Mustache. Using the template system is different if you use Dropwizard, Spark or any other tool. But that is out of scope today.

Narrow mustache


I would like to thank Malin Ekholm and Johan Helmfrid for proof reading.


Dropwizard - a Java framework for developing ops-friendly, high-performance, RESTful web services

Spark - a tiny Sinatra inspired framework for creating web applications in Java 8 with minimal effort
Overall rating page: 4.5 / 5 left 278 people.

Posted by at 03:57PM

Tags: clipped moustache, moustache trimming tips, how to keep your mustache neat, mustache and chin hair, beard styles no moustache, mustache or goatee, how to draw a moustache on your face, how to grow big mustache, latest moustache trends, narrow mustache


There are no comments for this post "Include header and footer in a Mustache template". Be the first to comment...

Add Comment