all repos — homestead @ 526002b13309812ce647faff2bdf66d6991ec467

Code for my website

render .md files under root as pages (x.md => /x)

Alan Pearce
commit

526002b13309812ce647faff2bdf66d6991ec467

parent

b0c19c83493787485428221330c654defcd18505

1 file changed, 8 insertions(+), 2 deletions(-)

changed files
M internal/storage/files/reader.gointernal/storage/files/reader.go
@@ -78,10 +78,16 @@ }
func (r *Reader) CanonicalisePath(path string) (cPath string, differs bool) { cPath = path - if strings.HasSuffix(path, "/index.html") { + switch { + case strings.HasSuffix(path, "/index.html"): cPath, differs = strings.CutSuffix(path, "index.html") - } else if !strings.HasSuffix(path, "/") && r.files[path+"/"] != nil { + + case strings.HasSuffix(path, ".html"): + cPath, differs = strings.CutSuffix(path, ".html") + + case !strings.HasSuffix(path, "/") && r.files[path+"/"] != nil: cPath, differs = path+"/", true + } return cPath, differs