Skip to content

Commit

Permalink
fix(redirect): fix failure when redirecting from index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Nov 30, 2022
1 parent 8a78073 commit af74119
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/redirect/src/node/generate.ts
Expand Up @@ -29,9 +29,12 @@ export const generateHTML = async (
(<Page<Record<string, never>, RedirectPluginFrontmatterOption>[]>pages)
.map<[string, string][]>(({ frontmatter, path }) =>
Array.isArray(frontmatter.redirectFrom)
? frontmatter.redirectFrom.map((from) => [from, path])
? frontmatter.redirectFrom.map((from) => [
from.replace(/\/$/, "/index.html"),
path,
])
: frontmatter.redirectFrom
? [[frontmatter.redirectFrom, path]]
? [[frontmatter.redirectFrom.replace(/\/$/, "/index.html"), path]]
: []
)
.flat()
Expand Down

0 comments on commit af74119

Please sign in to comment.