From ad56116d0df26b4a6fe7f9cd04a21965d3184af5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 3 Oct 2017 15:30:54 +0200 Subject: Reify taxonomies into just tags. I'm probably not going to need anything else, and this makes it a lot clearer --- src/actions.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src/actions.js') diff --git a/src/actions.js b/src/actions.js index 2ad0c77..61f4fd8 100644 --- a/src/actions.js +++ b/src/actions.js @@ -50,17 +50,15 @@ function post(config, responder, posts) { }; } -function taxonGenerator(config, responder, term, items) { +function tag(config, responder, items) { return async function(ctx, next) { - const value = ctx.params.value; - ctx.assert(items.has(ctx.params.value), 404, `${term} ${value} not found`); - - const taxonItems = items.get(value); + const tag = ctx.params.name; + ctx.assert(items.has(tag), 404, `tag ${tag} not found`); responder(ctx, config, { - listType: term, - listName: value, - posts: taxonItems + listType: "tag", + listName: tag, + posts: items.get(tag) }); }; } @@ -79,6 +77,6 @@ module.exports = { posts, highlightTheme, post, - taxonGenerator, + tag, serveFiles }; -- cgit 1.4.1