Eta
Use the template engine Eta to build pages.
Options
Description
Eta is a JavaScript template engine with a syntax very similar to EJS. This plugin allows using this template engine to create pages and layouts.
Installation
Import this plugin in your _config.ts file to use it:
import lume from "lume/mod.ts";
import eta from "lume/plugins/eta.ts";
const site = lume();
site.use(eta(/* Options */));
export default site;
Creating layouts
Add a file with .eta extension in the _includes directory. Use the layout page variable to specify this layout.
---
title: Welcome to my page intro: This is my first post using lume, I hope
you like it!
---
<html>
<head>
<title><%= title %></title>
</head>
<body>
<%~ await includeFile("partials/nav.eta") %>
<p><%= title %></p>
</body>
</html>
Note that the paths passed to includeFile() function are always relative to the _includes directory.
Creating pages
Creating pages is the same as creating layouts, just place the .eta file outside the _includes directory.
Configure VSCode
You can use the Eta extension for VS Code for syntax highlight and some useful snippets.