Skip to content

Commit

Permalink
⚡ Perf: add front matter hiddenFromFeed for JSON feed (#475)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Aug 13, 2024
1 parent cd574fa commit cbdfa1b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ enableEmoji = true
# FixIt 0.3.10 | NEW Feed config for RSS, Atom and JSON feed.
[params.feed]
# The number of posts to include in the feed. Default is -1, which means all posts.
limit = 10
limit = -1
# whether to show the full text content in feed.
fullText = false

Expand Down
5 changes: 4 additions & 1 deletion layouts/partials/feed/json-feed.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{{- $pages := .Pages -}}
{{- /* Front matter: password */ -}}
{{- $pages = where $pages "Params.password" "eq" nil -}}
{{- /* Front matter: hiddenFromFeed */ -}}
{{- $pages = where $pages "Params.hiddenFromFeed" "ne" true -}}
{{- $limit := .Site.Params.feed.limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- $length := $pages.Len -}}
{{- /* TODO 加密的不显示,加入 hiddenFromFeed */ -}}

{
"version": "https://jsonfeed.org/version/1.1",
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/init/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.10-874913ce" -}}
{{- .Scratch.Set "version" "v0.3.10-cd574fa2" -}}
{{- .Scratch.Set "this" dict -}}

{{- partial "init/detection-env.html" . -}}
Expand Down

0 comments on commit cbdfa1b

Please sign in to comment.