diff --git a/builder/article.go b/builder/article.go index c5e37868..dbfeb0fa 100644 --- a/builder/article.go +++ b/builder/article.go @@ -30,6 +30,7 @@ type Article struct { HowTo *HowTo `yaml:"howto"` BreadCrumb []BreadCrumbItem `yaml:"breadcrumb"` Layout string `yaml:"layout"` + Hidden bool `yaml:"hidden"` Markdown []byte `yaml:"-"` Content template.HTML `yaml:"-"` diff --git a/builder/autoindex.go b/builder/autoindex.go index 50091ad6..740b36a2 100644 --- a/builder/autoindex.go +++ b/builder/autoindex.go @@ -513,13 +513,20 @@ type SitemapContext struct { } func (g *IndexGenerator) generateSitemap(dst fs.Writable, articles ArticleList, conf Config) (ArtifactList, error) { + as := make(ArticleList, 0, len(articles)) + for _, a := range articles { + if !a.Hidden { + as = append(as, a) + } + } + targetPath := "sitemap.xml" result := ArtifactList{Index{ name: targetPath, - sources: articles.Sources(), + sources: as.Sources(), }} - if fs.ModTime(dst, targetPath).After(articles.ModTime()) { + if fs.ModTime(dst, targetPath).After(as.ModTime()) { return result, nil } @@ -535,7 +542,7 @@ func (g *IndexGenerator) generateSitemap(dst fs.Writable, articles ArticleList, err = tmpl.Execute(output, SitemapContext{ URL: "https://blanktar.jp/sitemap.xml", - Pages: articles, + Pages: as, }) if err != nil { output.Close() diff --git a/pages/404.md b/pages/404.md new file mode 100644 index 00000000..f3abe594 --- /dev/null +++ b/pages/404.md @@ -0,0 +1,6 @@ +--- +layout: error.html +title: 404 +description: ページが見つかりません +hidden: true +--- diff --git a/templates/error.html b/templates/error.html new file mode 100644 index 00000000..1d345b2f --- /dev/null +++ b/templates/error.html @@ -0,0 +1,41 @@ +{{define "title"}}{{.Description}} - Blanktar{{end}} + +{{/* */}} + +{{define "body"}} +
+
+ {{.Title}} +

{{.Description}}

+

トップページに戻る

+
+
+{{end}}