๐Ÿ“ฆ payloadcms / website

๐Ÿ“„ redirects.js ยท 54 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54import { formatPermalink } from './src/utilities/formatPermalink.js'

export const redirects = async () => {
  const staticRedirects = [
    {
      source: '/docs',
      destination: '/docs/getting-started/what-is-payload',
      permanent: true,
    },
    {
      source: '/docs/beta',
      destination: '/docs/beta/getting-started/what-is-payload',
      permanent: false,
    },
    {
      source: '/docs/v2',
      destination: '/docs/v2/getting-started/what-is-payload',
      permanent: true,
    },
    {
      source: '/roadmap',
      destination: 'https://github.com/payloadcms/payload/discussions/categories/roadmap',
      permanent: true,
    },
    {
      source: '/blog',
      destination: '/posts/blog',
      permanent: true,
    },
    {
      source: '/blog/:slug',
      destination: '/posts/blog/:slug',
      permanent: true,
    },
  ]

  const internetExplorerRedirect = {
    source: '/:path((?!ie-incompatible.html$).*)', // all pages except the incompatibility page
    has: [
      {
        type: 'header',
        key: 'user-agent',
        value: '(.*Trident.*)', // all ie browsers
      },
    ],
    permanent: false,
    destination: '/ie-incompatible.html',
  }

  const redirects = [...staticRedirects, internetExplorerRedirect]

  return redirects
}