# Shortcodes and build order?

**URL:** <https://discourse.gohugo.io/t/shortcodes-and-build-order/57654>\
**Category:** support\
**Tags:** shortcodes\
**Created:** [October 12, 2026, 3:34pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654 "2026-10-12T15:34:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgadey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pgadey/32/23984_2.png) [@pgadey](https://discourse.gohugo.io/u/pgadey)\
**Post date:** [October 12, 2026, 3:34pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654/1 "2026-10-12T15:34:10Z")

</div>

On my Hugo site, I’ve implemented a pair of shortcodes “gather” and “dump.” The purpose of `gather` is to collect up a bunch of similar content, and `dump` puts it all in one place. However, the mechanism that I used to implement these, the global scratchpad, seems to be impacted by the order in which pages are built.

My questions are:  
Can I force a particular order in which pages are built?  
In particular, so that all the pages with the gather shortcode are built before the ones with dump?  
If not, is there a better way to implement this gather/dump mechanism?

For further context: Usually there are lots more gathers than dumps. Currently, I use this to gather up all the bookmarks on my webpage and dump them all in one spot. That was working fine until I wanted to gather all the books and dump them on a bibliography page. It was only then that I noticed the importance of page build order. The bookmarks page populates just fine, but the bibliography page does not.

Here’s are some of the relevant details of the implementation.

gather.html

```auto
{{/* gather the relevant information in the global scratchpad named $dest */}}

{{ $dest := .Get "dest" }}
{{ $exists := hugo.Store.Get $dest }}
{{ $backlink := printf `<a class="bookmark-back-reference" href="%s">⤝ %s</a>` .Page.Permalink .Page.Title }}

{{ if not $exists }}
	{{ hugo.Store.Set $dest $backlink }}
{{ end }}

{{ hugo.Store.Add $dest .Inner }}

{{ .Inner | markdownify }}

```

And here is dump.html.

```auto
{{/* dump the relevant information from the global scratchpad named $dest */}}

{{ $source := .Get "source" }}

{{ if eq hugo.Environment "development" }}

✒️
This page includes content gathered from:
{{ $source }}

{{ end }}

{{ hugo.Store.Get $source | markdownify }}

```

Of course, I’m happy to provide more details and clarify if there are any issues.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 12, 2026, 4:17pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654/2 "2026-10-12T16:17:54Z")

</div>

See [https://gohugo.io/functions/hugo/store/#determinate-values](https://gohugo.io/functions/hugo/store/#determinate-values).

You could range over the all the pages and force rendering with a noop as described above.

---

<div class="post-metadata">

**Author:** ![pgadey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pgadey/32/23984_2.png) [@pgadey](https://discourse.gohugo.io/u/pgadey)\
**Post date:** [October 12, 2026, 5:00pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654/3 "2026-10-12T17:00:33Z")

</div>

Wow! That’s not the sort of thing I ever would have imagined. Lemme play with it a bit.

Thanks for the speedy response.

---

<div class="post-metadata">

**Author:** ![pgadey](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pgadey/32/23984_2.png) [@pgadey](https://discourse.gohugo.io/u/pgadey)\
**Post date:** [October 12, 2026, 10:25pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654/4 "2026-10-12T22:25:30Z")

</div>

Yup! This worked in the end.

Initially, it really slowed down the build time from 20s to +10min. I don’t even know if the whole thing would have built eventually because I killed the process after +10min.

After that, I added a bit of logic to narrow down the scope of `.Site.Pages` and possible prevent an infinite loop. I don’t know if an infinite loop of `.Content` was the issue or not but the added logic seems to have fixed things. My website now renders in the usual ~20s.

```c
{{ $here := .Page.Permalink }}

{{ range (where .Site.Pages ".Section" "in" (slice "notes" "blog" "main")) }}
    {{ if ne .Permalink $here }}
        {{ $noop := .Content }}
    {{ end }}
{{ end }}

```

And now, both the bibliography and bookmarks pages render fine.

- [Bibliography | Parker Adey](https://pgadey.ca/bibliography/)
- [Bookmarks | Parker Adey](https://pgadey.ca/bookmarks/)

Thanks so much!

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 12, 2026, 11:52pm UTC](https://discourse.gohugo.io/t/shortcodes-and-build-order/57654/5 "2026-10-12T23:52:31Z")

</div>

Yeah, if you range through every page on every page… yikes. Either limit when you do it, or limit what you do it to, or both.
