Skip to content

Commit

Permalink
Merge pull request #899 from macrat/fix-not-found-page
Browse files Browse the repository at this point in the history
404ページが正しく表示されていない問題を修正
  • Loading branch information
macrat authored Mar 24, 2024
2 parents 291a454 + abc72d7 commit c694e53
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion builder/autoindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,13 @@ func (g *IndexGenerator) generateConfig(dst fs.Writable, as ArticleList, conf Co
Src string `json:"src,omitempty"`
Dest string `json:"dest,omitempty"`
Handle string `json:"handle,omitempty"`
Check bool `json:"check,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Status int `json:"status,omitempty"`
Continue bool `json:"continue,omitempty"`
}

routes := make([]Route, 0, len(as)+len(conf.Redirects)+len(conf.Headers)+4)
routes := make([]Route, 0, len(as)+len(conf.Redirects)+len(conf.Headers)+6)

routes = append(routes, Route{
Src: "/(.*)/",
Expand Down Expand Up @@ -636,6 +637,15 @@ func (g *IndexGenerator) generateConfig(dst fs.Writable, as ArticleList, conf Co
})
}

routes = append(routes, Route{
Handle: "miss",
}, Route{
Src: "/(.*)",
Dest: "/404.html",
Check: true,
Status: 404,
})

err = json.NewEncoder(output).Encode(map[string]any{
"version": 3,
"routes": routes,
Expand Down

0 comments on commit c694e53

Please sign in to comment.