From 7be872b48d2886e7331ca38b33005d40ffb187c0 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 1 Aug 2024 17:51:29 -0300 Subject: page: artist-alias: don't overshadow a normal artist page Also moves filtering logic into targets(). --- src/page/artist-alias.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js index c1177798..6af5ef8a 100644 --- a/src/page/artist-alias.js +++ b/src/page/artist-alias.js @@ -1,18 +1,32 @@ export const description = `redirects for aliased artist names`; export function targets({wikiData}) { - return wikiData.artistData.filter(artist => artist.isAlias); + const normalArtistDirectories = + wikiData.artistData + .filter(artist => !artist.isAlias) + .map(artist => artist.directory); + + return ( + wikiData.artistData + .filter(artist => artist.isAlias) + + // Don't generate a redirect page if this aliased name resolves to the + // same directory as the original artist! See issue #280. + .filter(aliasArtist => + aliasArtist.directory !== + aliasArtist.aliasedArtist.directory) + + // And don't generate a redirect page if this aliased name resolves to the + // same directory as any *other, non-alias* artist. In that case we really + // just need the page (at this directory) to lead to the actual artist with + // this directory - not be a redirect. See issue #543. + .filter(aliasArtist => + !normalArtistDirectories.includes(aliasArtist.directory))); } export function pathsForTarget(aliasArtist) { const {aliasedArtist} = aliasArtist; - // Don't generate a redirect page if this aliased name resolves to the same - // directory as the original artist! See issue #280. - if (aliasArtist.directory === aliasedArtist.directory) { - return []; - } - return [ { type: 'redirect', -- cgit 1.3.0-6-gf8a5