Hi everyone,
First I am fairly new to hugo and really did try my best to search the doc and the forums. I apologies in advance if this is an easy fix or not really worth anyone’s time here.
What I am trying to do:
Sort the terms of the month taxonomy in a specific order (by default it is coming out in alphabetical order).
What I have done so far
Here is what my partial looks like:
<div class="months">
<div class="container">
{{ $pageUrl := .URL }}
{{range $name, $taxonomy := .Site.Taxonomies.month.ByWeight}}
{{ if in $pageUrl $name }}
<a class="month-link month-is-active" href="/month/{{$name}}">{{$name}}</a>
{{else}}
<a class="month-link" href="/month/{{$name}}">{{$name}}</a>
{{end}}
{{end}}
</div>
</div>
Here’s what the front matter looks like for two different entry:
month:
- December
month_weight: 2
month:
- November
month_weight: 1
For some reason nothing renders and I have no error. This was my partial before using weight:
<div class="months">
<div class="container">
{{ $pageUrl := .URL }}
{{range $name, $taxonomy := .Site.Taxonomies.month}}
{{ if in $pageUrl $name }}
<a class="month-link month-is-active" href="/month/{{$name}}">{{$name}}</a>
{{else}}
<a class="month-link" href="/month/{{$name}}">{{$name}}</a>
{{end}}
{{end}}
</div>
</div>
This output the two different month but sort them in alphabetical order as mentioned above.