mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-04-21 05:31:53 +02:00
Merge pull request #1538 from mnjm/order-by-weight
✨ Articles ordering by weight
This commit is contained in:
commit
5ccc8c23cf
6 changed files with 45 additions and 47 deletions
|
@ -88,6 +88,7 @@ disableTextInHeader = false
|
||||||
showLikes = false
|
showLikes = false
|
||||||
showTableOfContents = false
|
showTableOfContents = false
|
||||||
showCards = false
|
showCards = false
|
||||||
|
orderByWeight = false
|
||||||
groupByYear = true
|
groupByYear = true
|
||||||
cardView = false
|
cardView = false
|
||||||
cardViewScreenWidth = false
|
cardViewScreenWidth = false
|
||||||
|
|
|
@ -87,6 +87,7 @@ smartTOCHideUnfocusedChildren = false
|
||||||
showLikes = false
|
showLikes = false
|
||||||
showTableOfContents = true
|
showTableOfContents = true
|
||||||
showCards = true
|
showCards = true
|
||||||
|
orderByWeight = false
|
||||||
groupByYear = false
|
groupByYear = false
|
||||||
cardView = true
|
cardView = true
|
||||||
cardViewScreenWidth = false
|
cardViewScreenWidth = false
|
||||||
|
|
|
@ -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.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.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.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.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. |
|
||||||
| `list.cardView` | `false` | Display lists as a gallery of cards. |
|
| `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. |
|
| `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
|
||||||
|
|
|
@ -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.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.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.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.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. |
|
||||||
| `list.cardView` | `false` | Display lists as a gallery of cards. |
|
| `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. |
|
| `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
|
||||||
|
|
|
@ -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.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.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.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.groupByYear` | `true` | Whether or not articles are grouped by year on list pages. |
|
||||||
| `list.cardView` | `false` | Display lists as a gallery of cards. |
|
| `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. |
|
| `list.cardViewScreenWidth` | `false` | Enhance the width of card galleries in lists to take the full width available. |
|
||||||
|
|
|
@ -61,80 +61,73 @@
|
||||||
{{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }}
|
{{ $cardView := .Params.cardView | default (.Site.Params.list.cardView | default false) }}
|
||||||
{{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }}
|
{{ $cardViewScreenWidth := .Params.cardViewScreenWidth | default (.Site.Params.list.cardViewScreenWidth | default false) }}
|
||||||
{{ $groupByYear := .Params.groupByYear | default ($.Site.Params.list.groupByYear | 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 }}
|
{{ if not $cardView }}
|
||||||
|
|
||||||
<section class="space-y-10 w-full">
|
<section class="space-y-10 w-full">
|
||||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
{{ if not $orderByWeight }}
|
||||||
{{ if $groupByYear }}
|
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||||
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
{{ if $groupByYear }}
|
||||||
{{ .Key }}
|
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||||
</h2>
|
{{ .Key }}
|
||||||
{{ end }}
|
</h2>
|
||||||
{{ range .Pages }}
|
{{ end }}
|
||||||
{{ partial "article-link/simple.html" . }}
|
{{ range .Pages }}
|
||||||
{{ end }}
|
{{ partial "article-link/simple.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ range (.Paginate (.Pages.ByWeight)).Pages }}
|
||||||
|
{{ partial "article-link/simple.html" . }}
|
||||||
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{ else if and $cardView (not $cardViewScreenWidth) }}
|
{{ else }}
|
||||||
|
|
||||||
{{ if $groupByYear }}
|
{{ if $groupByYear }}
|
||||||
|
|
||||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||||
<h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
{{ if $cardViewScreenWidth }}
|
||||||
{{ .Key }}
|
<div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
|
||||||
</h2>
|
{{ end }}
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
<h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
||||||
|
{{ .Key }}
|
||||||
|
</h2>
|
||||||
|
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 {{ if $cardViewScreenWidth }} xl:grid-cols-4 2xl:grid-cols-5 {{ end }}">
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
{{ partial "article-link/card.html" . }}
|
{{ partial "article-link/card.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
{{ if $cardViewScreenWidth }} </div> {{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|
||||||
|
{{ if $cardViewScreenWidth }}
|
||||||
|
<div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
|
||||||
|
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
|
||||||
|
{{ else }}
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3">
|
||||||
|
{{ end }}
|
||||||
|
{{ if not $orderByWeight }}
|
||||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
||||||
{{ range .Pages }}
|
{{ range .Pages }}
|
||||||
{{ partial "article-link/card.html" . }}
|
{{ partial "article-link/card.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{ range (.Paginate (.Pages.ByWeight)).Pages }}
|
||||||
|
{{ partial "article-link/card.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
|
{{ if $cardViewScreenWidth }} </div> {{ end }}
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ else if and $cardView $cardViewScreenWidth }}
|
|
||||||
|
|
||||||
{{ if $groupByYear }}
|
|
||||||
|
|
||||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
|
||||||
<div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
|
|
||||||
<h2 class="mt-12 mb-3 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
|
|
||||||
{{ .Key }}
|
|
||||||
</h2>
|
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
|
|
||||||
{{ range .Pages }}
|
|
||||||
{{ partial "article-link/card.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ else }}
|
|
||||||
|
|
||||||
<div class="relative w-screen max-w-[1600px] px-[30px]" style="left: calc(max(-50vw,-800px) + 50%);">
|
|
||||||
<section class="w-full grid gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5">
|
|
||||||
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
|
|
||||||
{{ range .Pages }}
|
|
||||||
{{ partial "article-link/card.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue