Skip to content

Commit b3285d2

Browse files
authored
[docsite]: fix error page if template not exists (#98)
1 parent 65b3234 commit b3285d2

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

site.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,15 @@ type Site struct {
6868
func (s *Site) GetResources(dir, version string) (http.FileSystem, error) {
6969
c, err := s.Content.OpenVersion(context.Background(), version)
7070
if err != nil {
71-
return nil, err
71+
// if template dir doesn't exist, use the default one from main
72+
if errors.Is(err, os.ErrNotExist) {
73+
c, err = s.Content.OpenVersion(context.Background(), "")
74+
if err != nil {
75+
return nil, err
76+
}
77+
} else {
78+
return nil, err
79+
}
7280
}
7381
return &subdirFileSystem{fs: c, path: "_resources/" + dir}, nil
7482
}

0 commit comments

Comments
 (0)