summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-06-18 18:43:56 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-06-18 18:43:56 +0200
commitb738f38af8551021f77ad759425063d06e3c80de (patch)
treee44a8864ed0669bcfd07272db377a3c08dcd82c5 /README.md
parent66e62b48a9f10ca1722cead466ba0b4a0e1239a5 (diff)
downloadjbmafp-b738f38af8551021f77ad759425063d06e3c80de.tar.gz
Added first, last, random filters
Diffstat (limited to 'README.md')
-rw-r--r--README.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/README.md b/README.md
index 773f233..a04c9de 100644
--- a/README.md
+++ b/README.md
@@ -158,6 +158,35 @@ Payload {
})
```
+## Special filters
+
+- first (gets first N posts)
+- last (gets last N posts)
+- random (gets random N posts)
+
+```html
+<!-- First 10 pages -->
+{{ range first 10 .Pages }}
+ {{ if and (eq .Type "post") (not .Draft) }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+{{ end }}
+
+<!-- Last 10 pages -->
+{{ range last 10 .Pages }}
+ {{ if and (eq .Type "post") (not .Draft) }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+{{ end }}
+
+<!-- Random 10 pages -->
+{{ range random 10 .Pages }}
+ {{ if and (eq .Type "post") (not .Draft) }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+{{ end }}
+```
+
## License
[jbmafp](https://github.com/mitjafelicijan/jbmafp) was written by [Mitja