From 540336d7a5ca38a83c5da0f1d564c842789b8a4a Mon Sep 17 00:00:00 2001 From: Louis Barranqueiro Date: Sun, 15 Dec 2019 13:04:19 -0800 Subject: [PATCH] fix: add support for multi RSS feed - close #588 --- layout/_partial/head.ejs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/layout/_partial/head.ejs b/layout/_partial/head.ejs index aaff4c967..431c889c7 100755 --- a/layout/_partial/head.ejs +++ b/layout/_partial/head.ejs @@ -5,6 +5,7 @@ var fb_admin_ids = []; var keywords = ''; var photos = []; var publisher = ''; +var feeds = []; /** * Separate fb admin ids @@ -109,6 +110,24 @@ var publisher = ''; }); } })(); + +// Format RSS/Atom feeds. +(function() { + function getFeedContentType(feedType) { + return feedType === 'atom' ? 'atom' : 'rss'; + } + if (!config.feed || !config.feed.path.length) { + return; + } + var feedType = config.feed.type; + var feedPath = config.feed.path; + var feedTypes = typeof feedType === 'string' ? [feedType] : feedType; + var feedPaths = typeof feedPath === 'string' ? [feedPath] : feedPath; + + feedPaths.forEach((feedPath, index) => { + feeds.push({type: getFeedContentType(feedTypes[index]), path: feedPath}); + }) +})() %> @@ -122,8 +141,10 @@ var publisher = ''; <% if (theme.favicon) { %> <% } %> - <% if ((config.feed) && (config.feed.path.length)) { %> - + <% if (feeds.length) { %> + <% feeds.forEach(function(feed) { %> + + <% }) %> <% } %> <%- json_ld() %> <%- open_graph({