diff options
Diffstat (limited to 'src/page')
-rw-r--r-- | src/page/artist-alias.js | 28 |
1 files 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', |