feat: add hiddenFromHomePage param (#37)

This commit is contained in:
halulu 2018-03-08 22:05:58 +08:00 committed by olOwOlo
parent 8274b4209d
commit 52777345e4
3 changed files with 17 additions and 1 deletions

View file

@ -15,6 +15,7 @@ comment: false
toc: false toc: false
autoCollapseToc: false autoCollapseToc: false
postMetaInFooter: false postMetaInFooter: false
hiddenFromHomePage: false
# You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright." # You can also define another contentCopyright. e.g. contentCopyright: "This is another copyright."
contentCopyright: false contentCopyright: false
reward: false reward: false

View file

@ -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.

View file

@ -1,7 +1,7 @@
{{ define "content" }} {{ define "content" }}
<section id="posts" class="posts"> <section id="posts" class="posts">
{{/* (index .Site.Paginate) */}} {{/* (index .Site.Paginate) */}}
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }} {{ $paginator := .Paginate (where (where .Data.Pages "Type" "post") ".Params.hiddenfromhomepage" "!=" true) }}
{{ range $paginator.Pages }} {{ range $paginator.Pages }}
{{ .Render "summary" }} {{ .Render "summary" }}
{{ end }} {{ end }}