diff options
author | (quasar) nebula <towerofnix@gmail.com> | 2021-06-10 16:57:02 -0300 |
---|---|---|
committer | (quasar) nebula <towerofnix@gmail.com> | 2021-06-10 16:57:02 -0300 |
commit | 4b04056f18555824dde09914553fde71ad2e009b (patch) | |
tree | 581d54a1c08769bd9fe9c566eef8c6501ec04bf6 /src/page | |
parent | 3318ceb4b7685abeaa2daec111ef503feacaefd9 (diff) |
show previous/next links in tag nav bar
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/tag.js | 51 |
1 files changed, 40 insertions, 11 deletions
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})` + } + ] + }; +} |