From 049576154abec39b9973aedf186511a9d6cd8756 Mon Sep 17 00:00:00 2001 From: Tissevert Date: Wed, 6 May 2020 10:25:46 +0200 Subject: [PATCH] Follow change in article lists' header structure by dynamically generating a link to the RSS feed --- share/js/domRenderer.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/share/js/domRenderer.js b/share/js/domRenderer.js index aa4a57b..1a28d36 100644 --- a/share/js/domRenderer.js +++ b/share/js/domRenderer.js @@ -83,12 +83,30 @@ function DomRenderer(modules) { return function(articlePreviews) { return [ modules.dom.make('h2', {innerText: pageTitle(tag, all)}), - modules.dom.make('a', { - innerText: all ? blog.wording.latestLink : blog.wording.allLink, - href: otherUrl(tag, all) - }), - modules.dom.make('div', {class: 'articles'}, articlePreviews.filter(modules.fun.defined)) + modules.dom.make('ul', {}, articlesListLinks(tag, all)), + modules.dom.make('div', {class: 'articles'}, + articlePreviews.filter(modules.fun.defined) + ) ]; }; } + + function articlesListLinks(tag, all) { + var links = [ + modules.dom.make('a', { + innerText: all ? blog.wording.latestLink : blog.wording.allLink, + href: otherUrl(tag, all), + class: 'other' + }) + ]; + if(blog.hasRSS) { + links.unshift(modules.dom.make('a', { + innerText: blog.wording.rssLink, + href: 'rss.xml', + class: 'RSS', + title: modules.template.render('rssTitle', {tag: tag}) + })); + } + return links.map(function(e) {return modules.dom.make('li', {}, [e]);}); + } }