Skip to content

Commit 7be872b

Browse files
committed
page: artist-alias: don't overshadow a normal artist page
Also moves filtering logic into targets().
1 parent 4c3caa2 commit 7be872b

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/page/artist-alias.js

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
export const description = `redirects for aliased artist names`;
22

33
export function targets({wikiData}) {
4-
return wikiData.artistData.filter(artist => artist.isAlias);
4+
const normalArtistDirectories =
5+
wikiData.artistData
6+
.filter(artist => !artist.isAlias)
7+
.map(artist => artist.directory);
8+
9+
return (
10+
wikiData.artistData
11+
.filter(artist => artist.isAlias)
12+
13+
// Don't generate a redirect page if this aliased name resolves to the
14+
// same directory as the original artist! See issue #280.
15+
.filter(aliasArtist =>
16+
aliasArtist.directory !==
17+
aliasArtist.aliasedArtist.directory)
18+
19+
// And don't generate a redirect page if this aliased name resolves to the
20+
// same directory as any *other, non-alias* artist. In that case we really
21+
// just need the page (at this directory) to lead to the actual artist with
22+
// this directory - not be a redirect. See issue #543.
23+
.filter(aliasArtist =>
24+
!normalArtistDirectories.includes(aliasArtist.directory)));
525
}
626

727
export function pathsForTarget(aliasArtist) {
828
const {aliasedArtist} = aliasArtist;
929

10-
// Don't generate a redirect page if this aliased name resolves to the same
11-
// directory as the original artist! See issue #280.
12-
if (aliasArtist.directory === aliasedArtist.directory) {
13-
return [];
14-
}
15-
1630
return [
1731
{
1832
type: 'redirect',

0 commit comments

Comments
 (0)