diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-08-08 11:46:44 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-08-08 11:46:44 -0300 |
commit | 725482638dcc96632c3a9cf2b885f4128c50a1c1 (patch) | |
tree | 238bd34da7762ab50085d7d39f2a63c7921b0e33 /src | |
parent | f65bbab508cebdbaffd188366e983945d73abd4a (diff) |
write, content: restore & handle redirect titles properly
Diffstat (limited to 'src')
-rw-r--r-- | src/page/album.js | 1 | ||||
-rw-r--r-- | src/page/artist-alias.js | 2 | ||||
-rw-r--r-- | src/page/group.js | 2 | ||||
-rw-r--r-- | src/write/build-modes/live-dev-server.js | 6 | ||||
-rw-r--r-- | src/write/build-modes/static-build.js | 6 |
5 files changed, 11 insertions, 6 deletions
diff --git a/src/page/album.js b/src/page/album.js index 4ed5bcb1..3b2d02d2 100644 --- a/src/page/album.js +++ b/src/page/album.js @@ -68,6 +68,7 @@ export function pathsTargetless({wikiData: {wikiInfo}}) { type: 'redirect', fromPath: ['page', 'list/all-commentary'], toPath: ['commentaryIndex'], + title: 'Album Commentary', }, ]; } diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js index 9e9fdf5b..23513ce1 100644 --- a/src/page/artist-alias.js +++ b/src/page/artist-alias.js @@ -15,7 +15,7 @@ export function pathsForTarget(aliasArtist) { type: 'redirect', fromPath: ['artist', aliasArtist.directory], toPath: ['artist', aliasedArtist.directory], - title: () => aliasedArtist.name, + title: aliasedArtist.name, }, ]; } diff --git a/src/page/group.js b/src/page/group.js index e1ed4185..fa6c1c97 100644 --- a/src/page/group.js +++ b/src/page/group.js @@ -48,6 +48,7 @@ export function pathsTargetless({wikiData: {wikiInfo}}) { type: 'redirect', fromPath: ['page', 'albums/fandom'], toPath: ['groupGallery', 'fandom'], + title: 'Fandom - Gallery', }, wikiInfo.canonicalBase === 'https://hsmusic.wiki/' && @@ -55,6 +56,7 @@ export function pathsTargetless({wikiData: {wikiInfo}}) { type: 'redirect', fromPath: ['page', 'albums/official'], toPath: ['groupGallery', 'official'], + title: 'Official - Gallery', }, ]; } diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js index a87da27b..edee3267 100644 --- a/src/write/build-modes/live-dev-server.js +++ b/src/write/build-modes/live-dev-server.js @@ -321,6 +321,10 @@ export async function go({ try { if (page.type === 'redirect') { + const title = + page.title ?? + page.getTitle?.({language}); + const target = to('localized.' + page.toPath[0], ...page.toPath.slice(1)); response.writeHead(301, { @@ -328,7 +332,7 @@ export async function go({ 'Location': target, }); - const redirectHTML = generateRedirectHTML(page.title, target, {language}); + const redirectHTML = generateRedirectHTML(title, target, {language}); response.end(redirectHTML); diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js index dc2bb2c0..4f074058 100644 --- a/src/write/build-modes/static-build.js +++ b/src/write/build-modes/static-build.js @@ -355,10 +355,8 @@ export async function go({ }); }), - ...redirectWrites.map(({fromPath, toPath, title: titleFn}) => () => { - const title = titleFn({ - language, - }); + ...redirectWrites.map(({fromPath, toPath, title, getTitle}) => () => { + title ??= getTitle?.({language}); const to = getURLsFrom({ baseDirectory, |