# Is it possible to sort taxonomy terms based on a set term weight?

**URL:** <https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918>\
**Category:** support\
**Created:** [July 31, 2019, 2:30am UTC](https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918 "2019-07-31T02:30:46Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [August 3, 2019, 5:07pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918/23 "2019-08-03T17:07:30Z")

</div>

> [@johnson](#):
>
> So, how can I retrieve the category term? (great, large etc)

Replace `{{ .File.Dir | title }}` with `{{ .Title }}` but you need to specify the titles in the front matter of the taxonomy terms’ `_index.md` (currently in these files you have only entered `weight` and as a result the `.Title` variable returns empty, I used the `.File.Dir` variable to illustrate the end result.

Also have a look at: [Taxonomies | Hugo](https://gohugo.io/content-management/taxonomies/#add-custom-metadata-to-a-taxonomy-term)

---

<div class="post-metadata">

**Author:** ![johnson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/johnson/32/9231_2.png) [@johnson](https://discourse.gohugo.io/u/johnson)\
**Post date:** [August 3, 2019, 5:22pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918/24 "2019-08-03T17:22:22Z")

</div>

Alternatively, we may use {{ path.Base .File.Dir }}.

So, essentially we treat taxonomy as a page.

Essentially, as I understand what’s missing are  
.Site.Taxonomies.categories.ByWeight and .ByParam  
Missing those we have to use more complicated solutions with GetPage and treat taxonomy as a page.  
We cannot retrieve taxonomy params outside taxonomy templates. Right?

@alexandros Thanks a lot for your help. I really appreciate.

---

<div class="post-metadata">

**Author:** ![johnson](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/johnson/32/9231_2.png) [@johnson](https://discourse.gohugo.io/u/johnson)\
**Post date:** [August 3, 2019, 8:45pm UTC](https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918/25 "2019-08-03T20:45:22Z")

</div>

@alexandros  
Unfortunately this solutions does not work if I have  
disableKinds: [“taxonomy”,“taxonomyTerm”] at my config.yaml

Since taxonomy pages are not wished in the site, I have to use this solution and then with a script delete the taxonomy pages. So, this is not an ideal situation.

[Previous page](https://discourse.gohugo.io/t/is-it-possible-to-sort-taxonomy-terms-based-on-a-set-term-weight/19918.md?page=1)
