Create Publican templates
106 words, 1-minute read
Create a src/template/
directory in your project:
terminal
cd src
mkdir template
Then create a default template file named default.html
with code such as:
src/template/default.html
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>${ data.title }</title>
</head>
<body>
${ include('_partials/header.html') }
<main>
<h1>${ data.title }</h1>
${ data.content }
</main>
</body>
</html>
Note how the content is slotted into place using JavaScript template literal ${ expressions }
:
${ data.title }
is thetitle
defined in the content’s front matter${ data.content }
is the main page content${ include('_partials/header.html') }
includes another file. Create that file with the following content:
src/template/_partials/header.html
<header>
<nav><a href="${ tacs.root }">HOME</a></nav>
</header>