add hidden page param #124
This commit is contained in:
parent
0b15d3bc48
commit
0c92c7b71a
@ -20,6 +20,7 @@ Anubis is a simple minimalist theme for [Hugo blog engine](https://gohugo.io/).
|
|||||||
- Utteranc.es
|
- Utteranc.es
|
||||||
- RSS feeds
|
- RSS feeds
|
||||||
- Hiding posts from the RSS feed
|
- Hiding posts from the RSS feed
|
||||||
|
- Hidden posts (available only by link)
|
||||||
- Translations (en, ru, fr, pl)
|
- Translations (en, ru, fr, pl)
|
||||||
- Custom CSS/JS
|
- Custom CSS/JS
|
||||||
- Multilingual mode
|
- Multilingual mode
|
||||||
@ -192,10 +193,13 @@ Based on environment.
|
|||||||
For production — allow all, for other — disallow all.
|
For production — allow all, for other — disallow all.
|
||||||
|
|
||||||
### Favorite posts
|
### Favorite posts
|
||||||
To mark posts as favorite just add `favorite: true` in post's front matter. It adds a "★" icon nearby post's title.
|
Add `favorite: true` to post front matter. It adds a "★" icon nearby post's title.
|
||||||
|
|
||||||
### Hiding posts from RSS
|
### Hiding posts from RSS
|
||||||
To hide a post from the RSS feed, just add `disable_feed: true` to its front matter.
|
Add `disable_feed: true` to post front matter.
|
||||||
|
|
||||||
|
### Make post available only by link
|
||||||
|
Add `hidden: true` to post front matter. Post also is not available in RSS feed.
|
||||||
|
|
||||||
### Pagination on post single page
|
### Pagination on post single page
|
||||||
Enabled by `paginationSinglePost` param in `params` section of config.
|
Enabled by `paginationSinglePost` param in `params` section of config.
|
||||||
|
12
exampleSite/content/post/hidden-post.md
Normal file
12
exampleSite/content/post/hidden-post.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
+++
|
||||||
|
author = "Dmitry Kolosov"
|
||||||
|
title = "Hidden Post"
|
||||||
|
date = "2021-12-24"
|
||||||
|
description = "Post available only by link"
|
||||||
|
tags = [
|
||||||
|
"privacy"
|
||||||
|
]
|
||||||
|
hidden = true
|
||||||
|
+++
|
||||||
|
|
||||||
|
This is hidden post
|
12
exampleSiteMultilingual/content/post/hidden-post.md
Normal file
12
exampleSiteMultilingual/content/post/hidden-post.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
+++
|
||||||
|
author = "Dmitry Kolosov"
|
||||||
|
title = "Hidden Post"
|
||||||
|
date = "2021-12-24"
|
||||||
|
description = "Post available only by link"
|
||||||
|
tags = [
|
||||||
|
"privacy"
|
||||||
|
]
|
||||||
|
hidden = true
|
||||||
|
+++
|
||||||
|
|
||||||
|
This is hidden post
|
12
exampleSiteMultilingual/content/post/hidden-post.pl.md
Normal file
12
exampleSiteMultilingual/content/post/hidden-post.pl.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
+++
|
||||||
|
author = "Dmitry Kolosov"
|
||||||
|
title = "Hidden Post"
|
||||||
|
date = "2021-12-24"
|
||||||
|
description = "Post available only by link"
|
||||||
|
tags = [
|
||||||
|
"privacy"
|
||||||
|
]
|
||||||
|
hidden = true
|
||||||
|
+++
|
||||||
|
|
||||||
|
This is hidden post
|
@ -5,11 +5,11 @@
|
|||||||
|
|
||||||
<div class="articles h-feed">
|
<div class="articles h-feed">
|
||||||
<h1 class="post-title">{{ i18n .Title }}</h1>
|
<h1 class="post-title">{{ i18n .Title }}</h1>
|
||||||
{{ $pages := where .Pages "Type" "in" site.Params.mainSections }}
|
{{ $pages := where (where .Pages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true}}
|
||||||
{{ range $pages }}
|
{{ range $pages }}
|
||||||
<div class="post-short-list h-entry">
|
<div class="post-short-list h-entry">
|
||||||
<div class="post-header">
|
<div class="post-header">
|
||||||
<header>
|
<header>
|
||||||
<h2 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
|
<h2 class="p-name post-title{{ if .Params.favorite }} favorite{{end}}{{ if .Params.draft }} draft{{end}}"><a class="u-url" href="{{ .RelPermalink }}">{{ trim .Title " " }}</a></h2>
|
||||||
{{ partial "post-language-switcher.html" . }}
|
{{ partial "post-language-switcher.html" . }}
|
||||||
</header>
|
</header>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{{- $pctx := . -}}
|
{{- $pctx := . -}}
|
||||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||||
{{- $pages := where $pctx.RegularPages ".Params.disable_feed" "!=" true -}}
|
{{- $pages := where (where $pctx.RegularPages ".Params.disable_feed" "!=" true) "Params.hidden" "!=" true -}}
|
||||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||||
{{- if ge $limit 1 -}}
|
{{- if ge $limit 1 -}}
|
||||||
{{- $pages = $pages | first $limit -}}
|
{{- $pages = $pages | first $limit -}}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
<div class="post-info">
|
<div class="post-info">
|
||||||
<a href="{{ (print .Data.Plural "/") | relLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
|
<a href="{{ (print .Data.Plural "/") | relLangURL }}">{{ i18n (printf "toAll%s" (.Data.Plural | humanize )) | humanize }}</a>
|
||||||
</div>
|
</div>
|
||||||
{{ range .Paginator.Pages }}
|
{{ $pages := where .Pages "Params.hidden" "!=" true }}
|
||||||
|
{{ range (.Paginate $pages).Pages }}
|
||||||
{{ partial "post-summary.html" . }}
|
{{ partial "post-summary.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="articles h-feed">
|
<div class="articles h-feed">
|
||||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
{{ $pages := where (where site.RegularPages "Type" "in" site.Params.mainSections) "Params.hidden" "!=" true }}
|
||||||
{{ range (.Paginate $pages).Pages }}
|
{{ range (.Paginate $pages).Pages }}
|
||||||
{{ partial "post-summary.html" . }}
|
{{ partial "post-summary.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user