# Truncating 'Popular Topics' in the Academic theme

**URL:** https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925
**Category:** support
**Created:** [July 31, 2019, 1:23pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925 "2019-07-31T13:23:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![byrdjb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/byrdjb/32/9213_2.png) [@byrdjb](https://discourse.gohugo.io/u/byrdjb)
#### Post date: [July 31, 2019, 1:23pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/1 "2019-07-31T13:23:52Z")

</div>

Hugo-Academic has a widget that is a tag cloud that displays as: ‘Popular Topics.’

I like it, but I have been pretty diligent in my tagging, and I would like to display only the top 10 or 15 most frequently occurring tags, rather than every tag.

Short of deleting tags, how can I truncate the list of tags included in the tag cloud?

Thanks!

---

<div class="post-metadata">

### Author: ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)
#### Post date: [July 31, 2019, 1:44pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/2 "2019-07-31T13:44:02Z")

</div>

You can use

`{{ range first 10 site.Taxonomies.tags.ByCount }}`

ev. you should append .Reverse

`{{ range first 10 site.Taxonomies.tags.ByCount.Reverse }}`

or

`{{ range last 10 site.Taxonomies.tags.ByCount }}`

---

<div class="post-metadata">

### Author: ![byrdjb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/byrdjb/32/9213_2.png) [@byrdjb](https://discourse.gohugo.io/u/byrdjb)
#### Post date: [July 31, 2019, 1:56pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/3 "2019-07-31T13:56:06Z")

</div>

Please forgive my ignorance, but do you happen to know to what file I would append this code?

---

<div class="post-metadata">

### Author: ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)
#### Post date: [July 31, 2019, 7:31pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/4 "2019-07-31T19:31:14Z")

</div>

I can only try

`/hugo-academic/layouts/partials/widgets/tag_cloud.html`

should be line 23

```
    {{ range $name, $taxonomy := site.Taxonomies.tags }}

```

try to change to

```
   {{ range $name, $taxonomy := last 10 site.Taxonomies.tags.ByCount }}

```

must fiddle with the syntax to get it running 😉

---

<div class="post-metadata">

### Author: ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)
#### Post date: [July 31, 2019, 8:16pm UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/5 "2019-07-31T20:16:52Z")

</div>

{{ range $name, $taxonomy := first10 site.Taxonomies.tags.ByCount }}

.ByCount gives you the highest first

---

<div class="post-metadata">

### Author: ![byrdjb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/byrdjb/32/9213_2.png) [@byrdjb](https://discourse.gohugo.io/u/byrdjb)
#### Post date: [August 1, 2019, 12:29am UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/6 "2019-08-01T00:29:23Z")

</div>

Thank you! I found that I had to add a space between first & 10, and then it worked exactly as I had hoped.😀

---

<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: [February 28, 2020, 8:12am UTC](https://discourse.gohugo.io/t/truncating-popular-topics-in-the-academic-theme/19925/7 "2020-02-28T08:12:42Z")

</div>


