]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
create: Fix new content command with future dates
authorJustus Perlwitz <justuswilhelm@users.noreply.github.com>
Wed, 27 Aug 2025 07:33:17 +0000 (07:33 +0000)
committerGitHub <noreply@github.com>
Wed, 27 Aug 2025 07:33:17 +0000 (09:33 +0200)
Fixes #12599

commands/new.go
testscripts/commands/new_content.txt

index 81e1c65a4e6f5deb30b1c13b58fdb87ec60805cf..08b63a8664c4214a6301ddfe5ea23f21aa14b6c2 100644 (file)
@@ -53,7 +53,9 @@ Ensure you run this within the root directory of your site.`,
                                        if len(args) < 1 {
                                                return newUserError("path needs to be provided")
                                        }
-                                       h, err := r.Hugo(flagsToCfg(cd, nil))
+                                       cfg := flagsToCfg(cd, nil)
+                                       cfg.Set("BuildFuture", true)
+                                       h, err := r.Hugo(cfg)
                                        if err != nil {
                                                return err
                                        }
index 2170583533408c02f063575927995121598272b9..a5cbbecba5695c2fdd2e5e54582fb404cefa1a20 100644 (file)
@@ -4,4 +4,24 @@ hugo new content --kind post post/first-post.md
 ! exists resources
 grep 'draft = true' content/post/first-post.md
 
+# Issue 12599
+cd $WORK
 
+hugo new site --format toml --force issue-12599
+cp hugo.toml issue-12599/hugo.toml
+cd issue-12599
+hugo new content content/s1/2099-12-31-p1.md
+hugo -DF
+grep 'DATE _2099-12-31_' public/s1/p1/index.html
+grep 'SLUG _p1_' public/s1/p1/index.html
+grep 'TITLE _2099 12 31 P1_' public/s1/p1/index.html
+
+-- hugo.toml --
+disableKinds = ['home','rss','section','sitemap','taxonomy','term']
+[frontmatter]
+date = [':filename', ':default']
+publishDate = [':filename', ':default']
+-- issue-12599/layouts/all.html --
+DATE _{{ .Date.Format "2006-01-02" }}_
+SLUG _{{ .Slug }}_
+TITLE _{{ .Title }}_