Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't overshadow a normal artist page with an artist alias redirect #544

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions src/page/artist-alias.js
Original file line number Diff line number Diff line change
@@ -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',
Expand Down