IMPROVEMENT: give a jsonp api to return the number of moments and fix incorrect count for a certain section.

This commit is contained in:
FarseaSH 2024-06-26 22:09:50 +08:00
parent 6c14c1355f
commit 5ad98eeadb
2 changed files with 6 additions and 2 deletions

View file

@ -0,0 +1,4 @@
function showMomentCount() { {{ $a := where $.Site.RegularPages "Section" .Section}}{{ if .IsHome }}{{ $a = $.Site.RegularPages }}{{ end }}
document.getElementById("momentCount").innerHTML = {{ len $a }};
}
showMomentCount()

View file

@ -1,4 +1,4 @@
{
{ {{ $a := where $.Site.RegularPages "Section" .Section}}{{ if .IsHome }}{{ $a = $.Site.RegularPages }}{{ end }}
"sectionName": "{{ default "index" .Section }}",
"momentCount": {{ len .Site.RegularPages }}
"momentCount": {{ len $a }}
}