Skip to content

Commit 551b783

Browse files
authored
Mapped taxonomies can live in sections (#1810)
1 parent 2129d82 commit 551b783

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

common-theme/layouts/partials/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{{ else if .Params.menus_to_map_for_courses }}
1919
{{ partial "map-menu-for-courses.html" .Params.menus_to_map_for_courses }}
2020
{{ else if .Params.taxonomy_to_map }}
21-
{{ partial "map-taxonomy.html" (dict "taxonomy_to_map" .Params.taxonomy_to_map "animation" $animation ) }}
21+
{{ partial "map-taxonomy.html" (dict "taxonomy_to_map" .Params.taxonomy_to_map "section" .Page.Section "animation" $animation ) }}
2222
{{ else }}
2323
<ol class="c-timeline c-timeline--card">
2424
{{- range site.Menus.syllabus }}

common-theme/layouts/partials/map-taxonomy.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
* animation (bool) - Whether to animate descriptions on cards.
66
*/}}
77
{{ $taxonomy_to_map := index . "taxonomy_to_map" }}
8+
{{ $section := index . "section" }}
89
{{ $animation := index . "animation" }}
910

1011

1112
{{ $sections := slice }}
1213

1314
{{/* You can't ask for a taxonomy to be sorted by weight, so we need to get weights and iterate ourselves - see https://discourse.gohugo.io/t/list-custom-taxonomy-terms-in-a-specific-order-not-alphabetical/18145/5 */}}
14-
{{ $terms := site.GetPage (printf "/%s" $taxonomy_to_map) }}
15+
{{ $terms := site.GetPage (printf "%s/%s" $section $taxonomy_to_map) }}
1516
{{ range $termPage := $terms.Pages.ByWeight }}
1617
{{ $termID := path.BaseName $termPage.Path }}
1718
{{ $termTitle := $termPage.Title }}

0 commit comments

Comments
 (0)