From 4b04056f18555824dde09914553fde71ad2e009b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 10 Jun 2021 16:57:02 -0300 Subject: show previous/next links in tag nav bar --- src/page/tag.js | 51 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 11 deletions(-) (limited to 'src/page') diff --git a/src/page/tag.js b/src/page/tag.js index 39bfda60..9ef3d8c3 100644 --- a/src/page/tag.js +++ b/src/page/tag.js @@ -28,6 +28,7 @@ export function write(tag, {wikiData}) { type: 'page', path: ['tag', tag.directory], page: ({ + generatePreviousNextLinks, getAlbumCover, getGridHTML, getThemeString, @@ -60,20 +61,48 @@ export function write(tag, {wikiData}) { ` }, - nav: { - links: [ - {toHome: true}, - wikiInfo.features.listings && - { - path: ['localized.listingIndex'], - title: strings('listingIndex.title') - }, - {toCurrentPage: true} - ] - } + nav: generateTagNav(tag, { + generatePreviousNextLinks, + link, + strings, + wikiData + }) }) }; return [page]; } +// Utility functions + +function generateTagNav(tag, { + generatePreviousNextLinks, + link, + strings, + wikiData +}) { + const previousNextLinks = generatePreviousNextLinks(tag, { + data: wikiData.tagData.filter(tag => !tag.isCW), + linkKey: 'tag' + }); + + return { + links: [ + {toHome: true}, + wikiData.wikiInfo.features.listings && + { + path: ['localized.listingIndex'], + title: strings('listingIndex.title') + }, + { + html: strings('tagPage.nav.tag', { + tag: link.tag(tag, {class: 'current'}) + }) + }, + previousNextLinks && { + divider: false, + html: `(${previousNextLinks})` + } + ] + }; +} -- cgit 1.3.0-6-gf8a5