diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-01-01 17:43:35 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-01-01 17:43:35 -0400 |
commit | a312b897e99251ff9d53014dbb86c7a3b7b6609c (patch) | |
tree | 46aa97345bd6d4905988d052c0d3271abc65b39a /src/page | |
parent | 2fb4acd20a5b311e5f3f8581eb58687ed9cc2d1f (diff) |
specify homepage navbar links & order in data
...rather than just making a guess off the order files are listed by directory access, and using out-of-place 'Show in Navigation Bar'
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/homepage.js | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/page/homepage.js b/src/page/homepage.js index d34f117b..882daf72 100644 --- a/src/page/homepage.js +++ b/src/page/homepage.js @@ -1,6 +1,10 @@ // Homepage specification. -import {empty} from '../util/sugar.js'; +import { + bindOpts, + empty, + withEntries, +} from '../util/sugar.js'; import { getNewAdditions, @@ -193,21 +197,16 @@ export function writeTargetless({wikiData}) { links: [ link.home('', {text: wikiInfo.nameShort, class: 'current', to}), - wikiInfo.enableListings && - link.listingIndex('', { - text: language.$('listingIndex.title'), - to, - }), - - wikiInfo.enableNews && - link.newsIndex('', {text: language.$('newsIndex.title'), to}), - - wikiInfo.enableFlashesAndGames && - link.flashIndex('', {text: language.$('flashIndex.title'), to}), - - ...staticPageData - .filter((page) => page.showInNavigationBar) - .map((page) => link.staticPage(page, {text: page.nameShort})), + ...html.fragment( + homepageLayout.navbarLinks?.map(text => + transformInline(text, { + link: + withEntries(link, entries => + entries.map(([key, fn]) => + [key, bindOpts(fn, { + preferShortName: true, + })])), + }))), ] .filter(Boolean) .map((html) => ({html})), |