aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archetypes/default.md1
-rw-r--r--exampleSite/content/post/hidden-post.md15
-rw-r--r--layouts/index.html2
3 files changed, 17 insertions, 1 deletions
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: '<a href="https://halu.lu" target="_blank">Halulu</a>'
+
+hiddenFromHomePage: true
+---
+
+This post is hidden from the home page.
+
+<!--more-->
+
+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" }}
<section id="posts" class="posts">
{{/* (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 }}