Skip to content

Commit

Permalink
[docsite]: fix error page if template not exists (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
cesrjimenez authored Aug 18, 2023
1 parent 65b3234 commit b3285d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion site.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ type Site struct {
func (s *Site) GetResources(dir, version string) (http.FileSystem, error) {
c, err := s.Content.OpenVersion(context.Background(), version)
if err != nil {
return nil, err
// if template dir doesn't exist, use the default one from main
if errors.Is(err, os.ErrNotExist) {
c, err = s.Content.OpenVersion(context.Background(), "")
if err != nil {
return nil, err
}
} else {
return nil, err
}
}
return &subdirFileSystem{fs: c, path: "_resources/" + dir}, nil
}
Expand Down

0 comments on commit b3285d2

Please sign in to comment.