+8
commands/build.go
+8
commands/build.go
···
178
178
if !isDraft || (isDraft && drafts) {
179
179
posts = append(posts, post)
180
180
}
181
+
182
+
// Copy the post to the root if it's marked as such.
183
+
// ex: build/blog/foo-bar -> build/foo-bar
184
+
if post.Meta["atroot"] == "true" {
185
+
os.Mkdir(filepath.Join(types.BuildDir, slug), 0755)
186
+
dstFile := filepath.Join(types.BuildDir, slug, "index.html")
187
+
util.CopyFile(filepath.Join(dstDir, slug, "index.html"), dstFile)
188
+
}
181
189
}
182
190
183
191
sort.Slice(posts, func(i, j int) bool {
+1
commands/new.go
+1
commands/new.go
+7
readme
+7
readme
···
52
52
go run contrib/style.go > syntax.css
53
53
54
54
55
+
SPECIAL META DIRECTIVES
56
+
57
+
• draft: sets a post to draft (boolean) and will only be rendered if
58
+
the build command is run with the --drafts flag.
59
+
• atroot: sets a post to be also rendered at the root of the site.
60
+
61
+
55
62
TEMPLATING
56
63
57
64
Non-index templates have access to the below objects: