b.AssertFileExists("public/docs/p1/index.html", true)
b.AssertFileExists("public/docs/p2/index.html", false)
}
+
+func TestPagesFromGoPathsWithDotsIssue12493(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['home','section','rss','sitemap','taxonomy','term']
+-- content/_content.gotmpl --
+{{ .AddPage (dict "path" "s-1.2.3/p-4.5.6" "title" "p-4.5.6") }}
+-- layouts/_default/single.html --
+{{ .Title }}
+`
+
+ b := hugolib.Test(t, files)
+
+ b.AssertFileExists("public/s-1.2.3/p-4.5.6/index.html", true)
+}
p.Path = path.Join(basePath, p.Path)
}
- if pagesFromData {
- // Note that NormalizePathStringBasic will make sure that we don't preserve the unnormalized path.
- // We do that when we create pages from the file system; mostly for backward compatibility,
- // but also because people tend to use use the filename to name their resources (with spaces and all),
- // and this isn't relevant when creating resources from an API where it's easy to add textual meta data.
- p.Path = paths.NormalizePathStringBasic(p.Path)
- }
-
if p.Content.Markup == "" && p.Content.MediaType == "" {
if ext == "" {
ext = "md"
p.Content.Markup = p.ContentMediaType.SubType
}
+ if pagesFromData {
+ if p.Kind == "" {
+ p.Kind = kinds.KindPage
+ }
+
+ // Note that NormalizePathStringBasic will make sure that we don't preserve the unnormalized path.
+ // We do that when we create pages from the file system; mostly for backward compatibility,
+ // but also because people tend to use use the filename to name their resources (with spaces and all),
+ // and this isn't relevant when creating resources from an API where it's easy to add textual meta data.
+ p.Path = paths.NormalizePathStringBasic(p.Path)
+ }
+
if p.Cascade != nil {
cascade, err := page.DecodeCascade(logger, p.Cascade)
if err != nil {