File tree 1 file changed +21
-7
lines changed
1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change 1
1
export const description = `redirects for aliased artist names` ;
2
2
3
3
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 ) ) ) ;
5
25
}
6
26
7
27
export function pathsForTarget ( aliasArtist ) {
8
28
const { aliasedArtist} = aliasArtist ;
9
29
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
-
16
30
return [
17
31
{
18
32
type : 'redirect' ,
You can’t perform that action at this time.
0 commit comments