Skip to content

Commit

Permalink
Issue theNewDynamic#697: Add setting order_sections_by_date
Browse files Browse the repository at this point in the history
  • Loading branch information
micw committed Jul 18, 2024
1 parent 33fbda0 commit 4daa604
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ enableRobotsTXT = true
background_color_class = "bg-black"
recent_posts_number = 3

# Sort sections by date (oldest first)
#order_sections_by_date = true

[[params.ananke_socials]]
name = "twitter"
url = "https://twitter.com/GoHugoIO"
5 changes: 5 additions & 0 deletions layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
{{ $section_name := . }}
{{/* Create a variable with that section to use in multiple places. */}}
{{ $section := where $.Site.RegularPages "Section" "in" $section_name }}

{{ if $.Site.Params.order_sections_by_date | default false }}
{{ $section = $section.ByDate }}
{{ end }}

{{ $section_count := len $section }}
{{ if ge $section_count 1 }}
<div class="pa3 pa4-ns w-100 w-70-ns center">
Expand Down

0 comments on commit 4daa604

Please sign in to comment.