Move to Nunjucks, move out base and header to separate templates
This commit is contained in:
parent
5175570be1
commit
1192c8fcfb
7 changed files with 50 additions and 42 deletions
|
@ -4,11 +4,9 @@ import { DateTime } from 'luxon';
|
|||
export default async function (config) {
|
||||
config.setInputDirectory('src');
|
||||
config.setOutputDirectory('dist');
|
||||
config.setIncludesDirectory('_includes');
|
||||
|
||||
config.setIncludesDirectory('src/_includes');
|
||||
config.setLayoutsDirectory('src/_layouts');
|
||||
|
||||
config.setTemplateFormats(['md', 'liquid', 'html']);
|
||||
config.setTemplateFormats(['md', 'njk', 'html']);
|
||||
config.addPassthroughCopy('src/styles.css');
|
||||
config.addPassthroughCopy('src/styles/**/*.css');
|
||||
config.addPassthroughCopy('src/assets/**/*');
|
||||
|
|
13
src/_includes/base.njk
Normal file
13
src/_includes/base.njk
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="/styles.css">
|
||||
{% block title %}{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{%- block body -%}{%- endblock -%}
|
||||
</body>
|
||||
</html>
|
5
src/_includes/header.njk
Normal file
5
src/_includes/header.njk
Normal file
|
@ -0,0 +1,5 @@
|
|||
<header>
|
||||
<hgroup class="title">
|
||||
<h1>This Weblog Belongs to<br>Z. Charles Dziura</h1>
|
||||
</hgroup>
|
||||
</header>
|
|
@ -1,36 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="stylesheet" href="/styles.css">
|
||||
<title>Z. Charles Dziura | Weblog</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<hgroup class="header__title">
|
||||
<h1>This Weblog Belongs to<br>Z. Charles Dziura</h1>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
{%- for post in collections.all -%}
|
||||
{%- if post.data.type == "thought" -%}
|
||||
<section class="thought">
|
||||
<header>
|
||||
<object data="assets/hash.svg" type="image/svg+xml"></object>
|
||||
An errant thought...
|
||||
</header>
|
||||
<div class="content">
|
||||
{{ post.content }}
|
||||
</div>
|
||||
<footer>
|
||||
Posted on {{ post.date | formatDate }}
|
||||
</footer>
|
||||
</section>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
28
src/index.njk
Normal file
28
src/index.njk
Normal file
|
@ -0,0 +1,28 @@
|
|||
{% extends "base.njk" %}
|
||||
|
||||
{%- block title -%}
|
||||
<title>Z. Charles Dziura | Weblog</title>
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block body -%}
|
||||
{%- include "header.njk" -%}
|
||||
|
||||
<main>
|
||||
{%- for post in collections.all -%}
|
||||
{%- if post.data.type == "thought" -%}
|
||||
<section class="thought">
|
||||
<header>
|
||||
<object data="assets/hash.svg" type="image/svg+xml"></object>
|
||||
An errant thought...
|
||||
</header>
|
||||
<div class="content">
|
||||
{{ post.content | safe }}
|
||||
</div>
|
||||
<footer>
|
||||
Posted on {{ post.date | formatDate }}
|
||||
</footer>
|
||||
</section>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</main>
|
||||
{%- endblock -%}
|
|
@ -24,13 +24,13 @@ body > header {
|
|||
width: max-content;
|
||||
}
|
||||
|
||||
body > header > .header__title {
|
||||
body > header > .title {
|
||||
background-color: var(--color-bg);
|
||||
color: var(--color-on-bg);
|
||||
padding: var(--size-md) var(--size-xl);
|
||||
}
|
||||
|
||||
body > header > .header__title > h1 {
|
||||
body > header > .title > h1 {
|
||||
font-size: var(--font-title);
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
|
|
0
src/thoughts.njk
Normal file
0
src/thoughts.njk
Normal file
Loading…
Add table
Reference in a new issue