ContainsAny func(filename string, subslices [][]byte) (bool, error)
}
+func isShorthCodeOrPartial(name string) bool {
+ return strings.HasPrefix(name, "shortcodes/") || strings.HasPrefix(name, "partials/")
+}
+
func CreateTemplateNames(d TemplateLookupDescriptor) (TemplateNames, error) {
name := filepath.ToSlash(d.RelPath)
}
// Ace and Go templates may have both a base and inner template.
- pathDir := filepath.Dir(d.RelPath)
-
- if ext == "amber" || strings.HasSuffix(pathDir, "partials") || strings.HasSuffix(pathDir, "shortcodes") {
+ if ext == "amber" || isShorthCodeOrPartial(name) {
// No base template support
return id, nil
}
+ pathDir := filepath.Dir(d.RelPath)
+
innerMarkers := goTemplateInnerMarkers
var baseFilename string
Name: "partials/menu.html",
OverlayFilename: "partials/menu.html",
}},
+ {"Partial in subfolder", TemplateLookupDescriptor{WorkingDir: workingDir, RelPath: "/partials/sub/menu.html"}, true,
+ "_default/baseof.html",
+ TemplateNames{
+ Name: "partials/sub/menu.html",
+ OverlayFilename: "/partials/sub/menu.html",
+ }},
+ {"Shortcode in subfolder", TemplateLookupDescriptor{WorkingDir: workingDir, RelPath: "shortcodes/sub/menu.html"}, true,
+ "_default/baseof.html",
+ TemplateNames{
+ Name: "shortcodes/sub/menu.html",
+ OverlayFilename: "shortcodes/sub/menu.html",
+ }},
{"AMP, no base", TemplateLookupDescriptor{WorkingDir: workingDir, RelPath: layoutPathAmp}, false, "",
TemplateNames{
Name: "_default/single.amp.html",