Made a Base Template with CSS, Header, and Footer
This makes a template that will be used for most pages. This also adds CSS, a header, and a footer to all pages that use the template.
- Made folder
/src/css - Made
simple.cssfile and added Simple CSS from https://cdn.simplecss.org/simple.css. - In
.eleventy.jsadded a passthrough for CSS undermodule.exports, abovereturn:
// Passthroughs
eleventyConfig.addPassthroughCopy('./src/css/');
- Made folder
/src/_includes/layouts. - Made layout file
base.njkin/layoutsand added HTML5 boilerplate. - In the
<head></head>ofbase.njkin<title></title>replaced Document with Brian's Website. - In the
<body></body>ofbase.njk, added<header></header>,<main></main>, and<footer></footer>. - In
<main></main>added{{ content | safe }}.[1] - In
index.md, added front matter:
---
title: Home
layout: /layouts/base
---
- Made folder
/_includes/partials. - In
/partialsmadeheader.htmlwith<h1>Brian's Website</h1>. - In
/partialsmadefooter.htmlwith "Made with ☕ and ⌨️ by Brian" - Included
header.htmlandfooter.htmlinbase.njkwith{% include "partials/FILENAME.html" %}.
Footnotes
-
To make code with curly brackets display correctly and not make an error, put the code between
{% raw %}and{% endraw %}. ↩