Skip to content

Commit

Permalink
sort order add $ context input
Browse files Browse the repository at this point in the history
  • Loading branch information
yaythomas committed Aug 20, 2020
1 parent e318130 commit ddd2f4f
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions layouts/partials/list/get-pages.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
{{ $paginateMax := $.Param "list_paginate" }}
{{ $sorter := $.Param "list_sort" | default "list/sort/weight-linktitle.html" }}
{{ if $paginateMax }}
{{ $out = (.Paginate ((partial $sorter $pages)) $paginateMax).Pages }}
{{ $out = (.Paginate ((partial $sorter (dict "context" $ "pages" $pages))) $paginateMax).Pages }}
{{ else }}
{{ $limit := $.Param "list_limit" | default 0 }}
{{ if gt $limit 0 }}
{{ $out = first $limit (partial $sorter $pages) }}
{{ $out = first $limit (partial $sorter (dict "context" $ "pages" $pages)) }}
{{ else }}
{{ $out = (partial $sorter $pages) }}
{{ $out = (partial $sorter (dict "context" $ "pages" $pages)) }}
{{ end }}
{{ end }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/list/sort/date.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ return .ByDate }}
{{ return .pages.ByDate }}
4 changes: 2 additions & 2 deletions layouts/partials/list/sort/group-by-param.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ $pages := slice }}
{{ range .GroupByParam ($.Param "list_sort_group_by_param") }}
{{ $pages = $pages | append .Pages.ByParam ($.Param "list_sort_param") }}
{{ range .pages.GroupByParam (.context.Param "list_sort_group_by_param") }}
{{ $pages = $pages | append .Pages.ByParam (.context.Param "list_sort_param") }}
{{ end }}
{{ return $pages }}
2 changes: 1 addition & 1 deletion layouts/partials/list/sort/hugo-default.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ return . }}
{{ return .pages }}
2 changes: 1 addition & 1 deletion layouts/partials/list/sort/param.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ return .ByParam ($.Param "list_sort_param") }}
{{ return .pages.ByParam (.context.Param "list_sort_param") }}
2 changes: 1 addition & 1 deletion layouts/partials/list/sort/weight-linktitle.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ $pages := slice }}
{{ range .GroupBy "Weight" }}
{{ range .pages.GroupBy "Weight" }}
{{ $pages = $pages | append .Pages.ByLinkTitle }}
{{ end }}
{{ return $pages }}
2 changes: 1 addition & 1 deletion layouts/partials/list/sort/weight.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ return .ByWeight }}
{{ return .pages.ByWeight }}

0 comments on commit ddd2f4f

Please sign in to comment.