commit 73f2332e2efa292b00fe11bfc88efdad553e43a5
parent 1e5670a8ed2f73cad47eea5a68f37661fc4e964e
Author: FIGBERT <figbert@figbert.com>
Date: Sat, 29 Aug 2020 13:38:40 -0700
:art: Merge projects and page templates
Diffstat:
9 files changed, 42 insertions(+), 55 deletions(-)
diff --git a/content/posts/_index.md b/content/posts/_index.md
@@ -2,7 +2,7 @@
title = "Posts"
description = ""
sort_by = "date"
-template = "posts.html"
+template = "page-list.html"
page_template = "article.html"
+++
diff --git a/content/projects/_index.md b/content/projects/_index.md
@@ -2,7 +2,7 @@
title = "Projects"
description = ""
sort_by = "weight"
-template = "projects.html"
+template = "page-list.html"
page_template = "article.html"
+++
diff --git a/static/global.css b/static/global.css
@@ -94,12 +94,12 @@ h6::before {
vertical-align: top;
}
-.post-preview {
+.page-preview {
margin-top: 2rem;
margin-bottom: 4rem;
}
-.post-preview > h3 {
+.page-preview > h3 {
margin: 0;
}
diff --git a/templates/page-list.html b/templates/page-list.html
@@ -0,0 +1,18 @@
+{% 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
@@ -0,0 +1,14 @@
+{% 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
@@ -0,0 +1,6 @@
+{% extends "base.html" %}
+
+{% block content %}
+ {{ page.content | safe }}
+{% endblock content %}
+
diff --git a/templates/post-preview.html b/templates/post-preview.html
@@ -1,14 +0,0 @@
-{% macro post_preview(post) %}
- <div class="post-preview">
- <h3><a href="{{ post.permalink }}">{{ post.title }}</a></h3>
- <small>{{ post.date| date(format="%B %d, %Y") }} :: {{ post.word_count }} words :: {{ post.reading_time }} mins</small>
- <div>
- {% if post.summary -%}
- {{ post.summary | markdown | safe }}
- {% else %}
- {{ post.content | safe | striptags | truncate(length=300) }}
- {%- endif %}
- </div>
- </div>
-{% endmacro input %}
-
diff --git a/templates/posts.html b/templates/posts.html
@@ -1,18 +0,0 @@
-{% extends "base.html" %}
-
-{% import "post-preview.html" as post_macros %}
-
-{% block posthead %}
- {% for post in section.pages %}
- <link rel="prerender" href="{{ post.permalink }}" />
- {% endfor %}
-{% endblock posthead %}
-
-{% block content %}
- {{ section.content | safe }}
-
- {% for post in section.pages %}
- {{ post_macros::post_preview(post=post) }}
- {% endfor %}
-{% endblock content %}
-
diff --git a/templates/projects.html b/templates/projects.html
@@ -1,19 +0,0 @@
-{% extends "base.html" %}
-
-{% block content %}
- {{ section.content | safe }}
-
- {% for project in section.pages %}
- <div>
- <h3><a href="{{ project.permalink }}">{{ project.title }}</a></h3>
- <div>
- {% if project.summary -%}
- {{ project.summary | markdown | safe }}
- {% else %}
- {{ project.content | safe | striptags | truncate(length=300) }}
- {%- endif %}
- </div>
- </div>
- {% endfor %}
-{% endblock content %}
-