commit d0c61b6f043e7fddb32ded924f12e2893898f3a0
parent 074b20eb9bd1251fc5abd1fa380227e40ee18d0b
Author: FIGBERT <figbert@figbert.com>
Date: Thu, 28 Jan 2021 00:59:49 -0800
Simplify template structure
Diffstat:
12 files changed, 100 insertions(+), 105 deletions(-)
diff --git a/content/_index.md b/content/_index.md
@@ -1,6 +1,7 @@
+++
title = "Home"
insert_anchor_links = "left"
+template = "section.html"
+++
## Hello World
diff --git a/content/posts/_index.md b/content/posts/_index.md
@@ -2,7 +2,7 @@
title = "Posts"
description = ""
sort_by = "date"
-template = "page-list.html"
+template = "list.html"
page_template = "article.html"
insert_anchor_links = "left"
+++
diff --git a/content/projects/_index.md b/content/projects/_index.md
@@ -2,7 +2,7 @@
title = "Projects"
description = ""
sort_by = "weight"
-template = "page-list.html"
+template = "list.html"
page_template = "article.html"
insert_anchor_links = "left"
+++
diff --git a/templates/404.html b/templates/404.html
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "index.html" %}
{% block content %}
<div class="error">
diff --git a/templates/article.html b/templates/article.html
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "index.html" %}
{% block posthead %}
<script type="application/ld+json">
diff --git a/templates/base.html b/templates/base.html
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <meta http-equiv="x-ua-compatible" content="ie=edge" />
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <meta
- name="viewport"
- content="width=device-width, initial-scale=1.0, viewport-fit=cover"
- />
-
- <meta name="theme-color" content="#4169e1"/>
- <link rel="icon" href="/icon.png"/>
-
- <meta property="og:type" content="website">
-
- <meta name="twitter:card" content="summary">
- <meta name="twitter:creator" content="@therealFIGBERT">
- <meta name="twitter:site" content="@therealFIGBERT">
-
- {% block description %}
- {% if page.description %}
- <meta name="description" content="{{ page.description }}" />
- <meta name="twitter:description" content="{{ page.description }}">
- {% else %}
- <meta name="description" content="{{ config.description }}" />
- <meta name="twitter:description" content="{{ config.description}}">
- {% endif %}
- {% endblock description %}
-
- {% if page.title %}
- <meta name="twitter:title" content="{{ page.title }}">
- {% else %}
- <meta name="twitter:title" content="{{ config.title }}">
- {% endif %}
-
- {% for link in config.extra.nav %}
- <link rel="prerender" href="{{ link.path }}" />
- {% endfor %}
-
- <title>
- {% block title %}
- {% if page.title %}{{ page.title }} :: {% endif %}{{ config.title }}
- {% endblock title %}
- </title>
-
- <link rel="stylesheet" href="{{ get_url(path="global.css") | safe }}">
- {% block posthead %}{% endblock posthead %}
- <script async defer data-website-id="05bb9f50-5cd2-451b-8b15-d9088cc614d0" integrity="sha384-SFgC+hTq6Y/T7BVtH5jNjyKuiSefSCTh8BN9KApl6huoN9KYDDnCXZd2e3dcoxbL" src="https://umami.figbert.com/umami.js" crossorigin="anonymous"></script>
- </head>
- <body>
- <header>
- <nav>
- {% for link in config.extra.nav %}
- <a href="{{ link.path }}">{{ link.name }}</a>
- {% endfor %}
- </nav>
- <hr/>
- </header>
- <main>
- {% block content %}{% endblock content %}
- </main>
- </body>
-</html>
-
diff --git a/templates/index.html b/templates/index.html
@@ -1,6 +1,64 @@
-{% extends "base.html" %}
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta http-equiv="x-ua-compatible" content="ie=edge" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta
+ name="viewport"
+ content="width=device-width, initial-scale=1.0, viewport-fit=cover"
+ />
-{% block content %}
- {{ section.content | safe }}
-{% endblock content %}
+ <meta name="theme-color" content="#4169e1"/>
+ <link rel="icon" href="/icon.png"/>
+
+ <meta property="og:type" content="website">
+
+ <meta name="twitter:card" content="summary">
+ <meta name="twitter:creator" content="@therealFIGBERT">
+ <meta name="twitter:site" content="@therealFIGBERT">
+
+ {% block description %}
+ {% if page.description %}
+ <meta name="description" content="{{ page.description }}" />
+ <meta name="twitter:description" content="{{ page.description }}">
+ {% else %}
+ <meta name="description" content="{{ config.description }}" />
+ <meta name="twitter:description" content="{{ config.description}}">
+ {% endif %}
+ {% endblock description %}
+
+ {% if page.title %}
+ <meta name="twitter:title" content="{{ page.title }}">
+ {% else %}
+ <meta name="twitter:title" content="{{ config.title }}">
+ {% endif %}
+
+ {% for link in config.extra.nav %}
+ <link rel="prerender" href="{{ link.path }}" />
+ {% endfor %}
+
+ <title>
+ {% block title %}
+ {% if page.title %}{{ page.title }} :: {% endif %}{{ config.title }}
+ {% endblock title %}
+ </title>
+
+ <link rel="stylesheet" href="{{ get_url(path="global.css") | safe }}">
+ {% block posthead %}{% endblock posthead %}
+ <script async defer data-website-id="05bb9f50-5cd2-451b-8b15-d9088cc614d0" integrity="sha384-SFgC+hTq6Y/T7BVtH5jNjyKuiSefSCTh8BN9KApl6huoN9KYDDnCXZd2e3dcoxbL" src="https://umami.figbert.com/umami.js" crossorigin="anonymous"></script>
+ </head>
+ <body>
+ <header>
+ <nav>
+ {% for link in config.extra.nav %}
+ <a href="{{ link.path }}">{{ link.name }}</a>
+ {% endfor %}
+ </nav>
+ <hr/>
+ </header>
+ <main>
+ {% block content %}{% endblock content %}
+ </main>
+ </body>
+</html>
diff --git a/templates/list.html b/templates/list.html
@@ -0,0 +1,26 @@
+{% extends "index.html" %}
+
+{% block posthead %}
+ {% for page in section.pages %}
+ <link rel="prerender" href="{{ page.permalink }}" />
+ {% endfor %}
+{% endblock posthead %}
+
+{% block content %}
+ {{ section.content | safe }}
+
+ {% for page in section.pages %}
+ <div class="page-preview">
+ <h3><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
+ <small>{{ page.date | date(format="%B %d, %Y") }} :: {{ page.word_count }} words :: {{ page.reading_time }} mins</small>
+ <div>
+ {% if page.summary -%}
+ {{ page.summary | markdown | safe }}
+ {% else %}
+ {{ page.content | safe | striptags | truncate(length=300) }}
+ {%- endif %}
+ </div>
+ </div>
+ {% endfor %}
+{% endblock content %}
+
diff --git a/templates/page-list.html b/templates/page-list.html
@@ -1,18 +0,0 @@
-{% extends "base.html" %}
-
-{% import "page-preview.html" as page_macro %}
-
-{% block posthead %}
- {% for page in section.pages %}
- <link rel="prerender" href="{{ page.permalink }}" />
- {% endfor %}
-{% endblock posthead %}
-
-{% block content %}
- {{ section.content | safe }}
-
- {% for page in section.pages %}
- {{ page_macro::page_preview(page=page) }}
- {% endfor %}
-{% endblock content %}
-
diff --git a/templates/page-preview.html b/templates/page-preview.html
@@ -1,14 +0,0 @@
-{% macro page_preview(page) %}
- <div class="page-preview">
- <h3><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
- <small>{{ page.date | date(format="%B %d, %Y") }} :: {{ page.word_count }} words :: {{ page.reading_time }} mins</small>
- <div>
- {% if page.summary -%}
- {{ page.summary | markdown | safe }}
- {% else %}
- {{ page.content | safe | striptags | truncate(length=300) }}
- {%- endif %}
- </div>
- </div>
-{% endmacro input %}
-
diff --git a/templates/page.html b/templates/page.html
@@ -1,4 +1,4 @@
-{% extends "base.html" %}
+{% extends "index.html" %}
{% block content %}
{{ page.content | safe }}
diff --git a/templates/section.html b/templates/section.html
@@ -0,0 +1,6 @@
+{% extends "index.html" %}
+
+{% block content %}
+ {{ section.content | safe }}
+{% endblock content %}
+