From 52777345e4db7693d665699346b86ffb25ae8077 Mon Sep 17 00:00:00 2001 From: halulu Date: Thu, 8 Mar 2018 22:05:58 +0800 Subject: [PATCH] feat: add hiddenFromHomePage param (#37) --- archetypes/default.md | 1 + exampleSite/content/post/hidden-post.md | 15 +++++++++++++++ layouts/index.html | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 exampleSite/content/post/hidden-post.md diff --git a/archetypes/default.md b/archetypes/default.md index 79e85b3..2b730f4 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -15,6 +15,7 @@ comment: false toc: false autoCollapseToc: false postMetaInFooter: false +hiddenFromHomePage: false # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright." contentCopyright: false reward: false diff --git a/exampleSite/content/post/hidden-post.md b/exampleSite/content/post/hidden-post.md new file mode 100644 index 0000000..a2034e1 --- /dev/null +++ b/exampleSite/content/post/hidden-post.md @@ -0,0 +1,15 @@ +--- +title: "This is a hidden post." +date: 2018-03-08T17:40:19+08:00 +lastmod: 2018-03-08T22:01:19+08:00 +draft: false +author: 'Halulu' + +hiddenFromHomePage: true +--- + +This post is hidden from the home page. + + + +But you can see it in archives, rss or other pages. \ No newline at end of file diff --git a/layouts/index.html b/layouts/index.html index 616afdb..26d6869 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,7 +1,7 @@ {{ define "content" }}
{{/* (index .Site.Paginate) */}} - {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} + {{ $paginator := .Paginate (where (where .Data.Pages "Type" "post") ".Params.hiddenfromhomepage" "!=" true) }} {{ range $paginator.Pages }} {{ .Render "summary" }} {{ end }}