moved website content to root
This commit is contained in:
@@ -18,7 +18,7 @@ import (
|
||||
// GET /
|
||||
// compiles the page template or component template matching the url
|
||||
func (s *Server) serveTemplates(r *http.Request) (response.Response, error) {
|
||||
name, args := s.getTemplateNameAndArgs(r, "internal/site/templates/component_bodies")
|
||||
name, args := s.getTemplateNameAndArgs(r, s.contentDir+"/templates/component_bodies")
|
||||
|
||||
b, err := s.templater.ExecuteComponentBody(name, args...)
|
||||
if err == nil {
|
||||
@@ -29,7 +29,7 @@ func (s *Server) serveTemplates(r *http.Request) (response.Response, error) {
|
||||
return s.handleTemplateError(err, args...)
|
||||
}
|
||||
|
||||
name, args = s.getTemplateNameAndArgs(r, "internal/site/templates/page_bodies")
|
||||
name, args = s.getTemplateNameAndArgs(r, s.contentDir+"/templates/page_bodies")
|
||||
|
||||
if b, err = s.templater.ExecutePage(name, args...); err == nil {
|
||||
return response.HTML(b), nil
|
||||
@@ -79,6 +79,7 @@ func (s *Server) getTemplateNameAndArgs(r *http.Request, templateDir string) (na
|
||||
// getComponentTemplateNameForURL eliminate any trailing .html or /, and checks for any
|
||||
// file with path parameters in the name, eg '{abc}.html.tmpl', prefering exact filename matches.
|
||||
func getTemplateNameForURL(u *url.URL, templateDir string) (name string, params map[string]string) {
|
||||
templateDir = path.Clean(templateDir)
|
||||
fp := strings.TrimPrefix(strings.TrimSuffix(strings.TrimSuffix(u.Path, ".html"), "/"), "/")
|
||||
if fp == "" {
|
||||
// "/" maps to "/index"
|
||||
|
||||
Reference in New Issue
Block a user