summary refs log tree commit diff stats
path: root/src/domain
diff options
context:
space:
mode:
Diffstat (limited to 'src/domain')
-rw-r--r--src/domain/posts.js22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/domain/posts.js b/src/domain/posts.js
index c6b57c5..1214072 100644
--- a/src/domain/posts.js
+++ b/src/domain/posts.js
@@ -68,33 +68,29 @@ async function getFolder(folder, getURL) {
   return new Map(posts.map(f => [getTitle(f), f]));
 }
 
-function taxonomise(taxonomies, posts) {
-  const taxons = new Map(Object.keys(taxonomies).map(t => [t, new Map()]));
+function tag(posts) {
+  const tags = new Map();
 
   for (let [, post] of posts) {
-    for (let [singularName, pluralName] of Object.entries(taxonomies)) {
-      if (post.data.has(pluralName)) {
-        for (let term of post.data.get(pluralName)) {
-          const current = taxons.get(singularName).get(term);
-          taxons
-            .get(singularName)
-            .set(term, current ? current.concat(post) : [post]);
-        }
+    if (post.data.has("tags")) {
+      for (let term of post.data.get("tags")) {
+        const current = tags.get(term);
+        tags.set(term, current ? current.concat(post) : [post]);
       }
     }
   }
 
-  return taxons;
+  return tags;
 }
 
 module.exports = async function(config, getURL) {
   const posts = await getFolder(config.folder, getURL);
-  const taxonomies = taxonomise(config.taxonomies, posts);
+  const tags = tag(posts);
   const lastPostDate = Math.max(Array.from(posts.values(), p => p.date));
   return {
     lastPostDate,
     posts,
-    taxonomies,
+    tags,
     get
   };
 };