Skip to content

Commit

Permalink
Merge pull request #54 from chimbori/extensionless-serving
Browse files Browse the repository at this point in the history
Serve extensionless URL `/some-url` from file `/some-url.html`
  • Loading branch information
danog committed Nov 6, 2023
2 parents 9718b42 + c4cd71c commit cf7a6db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions site/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,9 @@ func (s *Site) URLPage(urlpath string) (p Document, found bool) {
if !found {
p, found = s.Routes[filepath.Join(urlpath, "index.htm")]
}
if !found {
// Serve extensionless URL `/some-url` from file `/some-url.html`
p, found = s.Routes[filepath.Join(urlpath + ".html")]
}
return
}

0 comments on commit cf7a6db

Please sign in to comment.