Skip to content

Commit dc0fab6

Browse files
committed
feat(backend): Support README files in the docs directory
Many other Git platforms support it as well.
1 parent 22d00e9 commit dc0fab6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/backend/utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package backend
22

33
import (
4+
"fmt"
5+
46
"github.com/charmbracelet/soft-serve/git"
57
"github.com/charmbracelet/soft-serve/pkg/proto"
68
)
@@ -19,5 +21,9 @@ func LatestFile(r proto.Repository, ref *git.Reference, pattern string) (string,
1921
func Readme(r proto.Repository, ref *git.Reference) (readme string, path string, err error) {
2022
pattern := "[rR][eE][aA][dD][mM][eE]*"
2123
readme, path, err = LatestFile(r, ref, pattern)
24+
if err != nil {
25+
pattern := fmt.Sprintf("docs/%s", pattern)
26+
readme, path, err = LatestFile(r, ref, pattern)
27+
}
2228
return
2329
}

0 commit comments

Comments
 (0)