diff --git a/config.toml b/config.toml index 247407777ba..d5064edd798 100644 --- a/config.toml +++ b/config.toml @@ -80,3 +80,6 @@ relativeURLs = true weight = 50 [menu.main.params] icon = "fa-brands fa-github" + +[taxonomies] +poster = "poster" \ No newline at end of file diff --git a/content/leaderboard.md b/content/leaderboard.md new file mode 100644 index 00000000000..2bbd0be01ac --- /dev/null +++ b/content/leaderboard.md @@ -0,0 +1,8 @@ +# Leaderboard + +Remember that all submissions are reviewed. Sending in junk submissions to get high +up on the leaderboard means that they will be rejected, your placing on the leaderboard +will be penalised, and you will not see the light of heaven. Be told. + +{{< leaderboard >}} + diff --git a/themes/ndt2/layouts/shortcodes/leaderboard.html b/themes/ndt2/layouts/shortcodes/leaderboard.html new file mode 100644 index 00000000000..28a00298e21 --- /dev/null +++ b/themes/ndt2/layouts/shortcodes/leaderboard.html @@ -0,0 +1,36 @@ +{{ $taxonomyObject := .Site.Taxonomies.poster }} +{{ $ageRecent := -2 }} +{{ $startRecent := time.AsTime ( now.AddDate 0 0 $ageRecent) }} +{{ $recent := where .Site.Taxonomies.poster "Date" "gt" $startRecent }} + + +

Last {{ $ageRecent}} days leaderboard (filtering by time)

+
    +{{ range $recent.ByCount }} +
  1. {{ .Page.LinkTitle }} ({{ .Count }})
  2. +{{ end }} +
+ +

All-time leaderboard: Stuart (filtering by name)

+
    +{{ range (where ($taxonomyObject.ByCount ) "Name" "stuart langridge") }} +
  1. {{ .Page.LinkTitle }} ({{ .Count }})
  2. +{{ end }} +
+ +

All-time leaderboard: top 10 (showing only some)

+
    +{{ range (first 10 ($taxonomyObject.ByCount )) }} +
  1. {{ .Page.LinkTitle }} ({{ .Count }})
  2. +{{ end }} +
+ +

All-time leaderboard: everybody (show the lot)

+
    +{{ range $taxonomyObject.ByCount }} +
  1. {{ .Page.LinkTitle }} ({{ .Count }})
  2. +{{ end }} +
+ +

Leaderboard actual data for reference

+
{{ debug.Dump $taxonomyObject.ByCount }}
\ No newline at end of file