diff --git a/config/_default/params.toml b/config/_default/params.toml index 51d5eac8..10cfec16 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -88,6 +88,7 @@ disableTextInHeader = false showLikes = false showTableOfContents = false showCards = false + orderByWeight = false groupByYear = true cardView = false cardViewScreenWidth = false diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 325917e7..42f698c0 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -87,6 +87,7 @@ smartTOCHideUnfocusedChildren = false showLikes = false showTableOfContents = true showCards = true + orderByWeight = false groupByYear = false cardView = true cardViewScreenWidth = false diff --git a/exampleSite/content/docs/configuration/index.it.md b/exampleSite/content/docs/configuration/index.it.md index 8384efe1..b676a3e2 100644 --- a/exampleSite/content/docs/configuration/index.it.md +++ b/exampleSite/content/docs/configuration/index.it.md @@ -258,6 +258,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `list.showViews` | `false` | Whether or not list views are displayed. This requires firebase integrations to be enabled, look below. | | `list.showLikes` | `false` | Whether or not list likes are displayed. This requires firebase integrations to be enabled, look below. | | `list.showCards` | `false` | Whether or not each article is displayed as a card or as simple inline text. | +| `list.orderByWeight` | `false` | Whether or not articles are sorted by [weights](https://gohugo.io/methods/page/weight/). | | `list.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. | | `list.cardView` | `false` | Display lists as a gallery of cards. | | `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | diff --git a/exampleSite/content/docs/configuration/index.ja.md b/exampleSite/content/docs/configuration/index.ja.md index 8384efe1..b676a3e2 100644 --- a/exampleSite/content/docs/configuration/index.ja.md +++ b/exampleSite/content/docs/configuration/index.ja.md @@ -258,6 +258,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `list.showViews` | `false` | Whether or not list views are displayed. This requires firebase integrations to be enabled, look below. | | `list.showLikes` | `false` | Whether or not list likes are displayed. This requires firebase integrations to be enabled, look below. | | `list.showCards` | `false` | Whether or not each article is displayed as a card or as simple inline text. | +| `list.orderByWeight` | `false` | Whether or not articles are sorted by [weights](https://gohugo.io/methods/page/weight/). | | `list.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. | | `list.cardView` | `false` | Display lists as a gallery of cards. | | `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index ec7a9367..1f01f232 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -259,6 +259,7 @@ Many of the article defaults here can be overridden on a per article basis by sp | `list.showViews` | `false` | Whether or not list views are displayed. This requires firebase integrations to be enabled, look below. | | `list.showLikes` | `false` | Whether or not list likes are displayed. This requires firebase integrations to be enabled, look below. | | `list.showCards` | `false` | Whether or not each article is displayed as a card or as simple inline text. | +| `list.orderByWeight` | `false` | Whether or not articles are sorted by [weights](https://gohugo.io/methods/page/weight/). | | `list.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. | | `list.cardView` | `false` | Display lists as a gallery of cards. | | `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. | diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 6e6fecb8..9720468e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -51,7 +51,7 @@
{{ .Content }}
- + @@ -61,80 +61,73 @@ {{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }} {{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }} {{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | default false) }} + {{ $orderByWeight := .Params.orderByWeight | default ($.Site.Params.list.orderByWeight | default false) }} + {{ $groupByYear := and (not $orderByWeight) $groupByYear }} {{ if not $cardView }}
- {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ if $groupByYear }} -

- {{ .Key }} -

- {{ end }} - {{ range .Pages }} - {{ partial "article-link/simple.html" . }} - {{ end }} + {{ if not $orderByWeight }} + {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} + {{ if $groupByYear }} +

+ {{ .Key }} +

+ {{ end }} + {{ range .Pages }} + {{ partial "article-link/simple.html" . }} + {{ end }} + {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/simple.html" . }} + {{ end }} {{ end }}
- {{ else if and $cardView (not $cardViewScreenWidth) }} + {{ else }} {{ if $groupByYear }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} -

- {{ .Key }} -

-
+ {{ if $cardViewScreenWidth }} +
+ {{ end }} +

+ {{ .Key }} +

+
{{ range .Pages }} {{ partial "article-link/card.html" . }} {{ end }}
+ {{ if $cardViewScreenWidth }}
{{ end }} {{ end }} - {{ else }} + {{ else }} + {{ if $cardViewScreenWidth }} +
+
+ {{ else }}
+ {{ end }} + {{ if not $orderByWeight }} {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} {{ range .Pages }} {{ partial "article-link/card.html" . }} {{ end }} {{ end }} + {{ else }} + {{ range (.Paginate (.Pages.ByWeight)).Pages }} + {{ partial "article-link/card.html" . }} + {{ end }} + {{ end }}
+ {{ if $cardViewScreenWidth }}
{{ end }} {{ end }} - {{ else if and $cardView $cardViewScreenWidth }} - - {{ if $groupByYear }} - - {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} -
-

- {{ .Key }} -

-
- {{ range .Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} -
-
- {{ end }} - - {{ else }} - -
-
- {{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} - {{ range .Pages }} - {{ partial "article-link/card.html" . }} - {{ end }} - {{ end }} -
-
- - {{ end }} - {{end}} {{ else }}