From d39bfded014a31030c7e134350ad8717844ebe2b Mon Sep 17 00:00:00 2001
From: Shadowfacts
Date: Mon, 27 Jan 2020 19:31:59 -0500
Subject: [PATCH] Add year index pages
---
lib/generate/categories.ts | 6 ++--
lib/generate/index.ts | 4 ++-
lib/generate/paginated.ts | 2 +-
lib/generate/years.ts | 22 +++++++++++++++
lib/index.ts | 1 +
site/category.html.ejs | 39 ++------------------------
site/includes/article-listing.html.ejs | 14 +++++++++
site/includes/pagination.html.ejs | 23 +++++++++++++++
site/index.html.ejs | 39 ++------------------------
site/year.html.ejs | 13 +++++++++
10 files changed, 84 insertions(+), 79 deletions(-)
create mode 100644 lib/generate/years.ts
create mode 100644 site/includes/article-listing.html.ejs
create mode 100644 site/includes/pagination.html.ejs
create mode 100644 site/year.html.ejs
diff --git a/lib/generate/categories.ts b/lib/generate/categories.ts
index bbae10b..60f953c 100644
--- a/lib/generate/categories.ts
+++ b/lib/generate/categories.ts
@@ -1,7 +1,7 @@
import { Page, PostMetadata } from "../metadata";
import generatePaginated from "./paginated";
-export default async function homepage(posts: Page[]): Promise
<% for (const post of posts) { %>
-
-
- <%- include("includes/article-meta.html.ejs", { metadata: post.metadata }) %>
-
- <%- post.metadata.excerpt %>
-
-
- Read more...
-
-
+ <%- include("includes/article-listing.html.ejs", { post }) %>
<% } %>
-
\ No newline at end of file
+<%- include("includes/pagination.html.ejs", { pagination }) %>
diff --git a/site/includes/article-listing.html.ejs b/site/includes/article-listing.html.ejs
new file mode 100644
index 0000000..5fb615e
--- /dev/null
+++ b/site/includes/article-listing.html.ejs
@@ -0,0 +1,14 @@
+
+
+ <%- include("article-meta.html.ejs", { metadata: post.metadata }) %>
+
+ <%- post.metadata.excerpt %>
+
+
+ Read more...
+
+
\ No newline at end of file
diff --git a/site/includes/pagination.html.ejs b/site/includes/pagination.html.ejs
new file mode 100644
index 0000000..3245a8a
--- /dev/null
+++ b/site/includes/pagination.html.ejs
@@ -0,0 +1,23 @@
+
\ No newline at end of file
diff --git a/site/index.html.ejs b/site/index.html.ejs
index a14daec..571998a 100644
--- a/site/index.html.ejs
+++ b/site/index.html.ejs
@@ -5,43 +5,8 @@ metadata.layout = "default.html.ejs"
<% for (const post of posts) { %>
-
-
- <%- include("includes/article-meta.html.ejs", { metadata: post.metadata }) %>
-
- <%- post.metadata.excerpt %>
-
-
- Read more...
-
-
+ <%- include("includes/article-listing.html.ejs", { post }) %>
<% } %>
-
\ No newline at end of file
+<%- include("includes/pagination.html.ejs", { pagination }) %>
diff --git a/site/year.html.ejs b/site/year.html.ejs
new file mode 100644
index 0000000..3afdfad
--- /dev/null
+++ b/site/year.html.ejs
@@ -0,0 +1,13 @@
+```
+metadata.layout = "default.html.ejs"
+```
+
+
+
Posts from <%= year %>
+
+ <% for (const post of posts) { %>
+ <%- include("includes/article-listing.html.ejs", { post }) %>
+ <% } %>
+
+
+<%- include("includes/pagination.html.ejs", { pagination }) %>