# Can shortlinks get an "invocation-count" variable

**URL:** <https://zola.discourse.group/t/can-shortlinks-get-an-invocation-count-variable/671>\
**Category:** Feature requests\
**Created:** [October 27, 2020, 5:36am UTC](https://zola.discourse.group/t/can-shortlinks-get-an-invocation-count-variable/671 "2020-10-27T05:36:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![n0x4c](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@n0x4c](https://zola.discourse.group/u/n0x4c)\
**Post date:** [October 27, 2020, 5:36am UTC](https://zola.discourse.group/t/can-shortlinks-get-an-invocation-count-variable/671/1 "2020-10-27T05:36:41Z")

</div>

I’m porting a website to Zola, and find myself searching for ways to manage end notes and margin notes. One hangup has been that shortcode-based solutions lack (at least as far as I can tell) a way to automatically number the resulting codes. It would be nice if a built-in variable (a la the `body` variable) were introduced that was simply an integer representing the number of times a particular shortcode was used up to that point in a given .md file. For the sake of example, let’s call the proposed variable `instance`. Then, given a shortcode template “sidenote.html:”

```auto
<aside id="sn{{ instance }}">{{ instance }}: {{ body }}</aside>

```

`instance` would resolve to “1” on the first invocation of `{% sidenote %}`, “2” on the second invocation, and so forth. If you come to a consensus that this seems reasonable, I will gladly start work on a PR.

---

<div class="post-metadata">

**Author:** ![anthonychwong](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/anthonychwong/32/471_2.png) [@anthonychwong](https://zola.discourse.group/u/anthonychwong)\
**Post date:** [March 28, 2021, 4:10pm UTC](https://zola.discourse.group/t/can-shortlinks-get-an-invocation-count-variable/671/2 "2021-03-28T16:10:41Z")

</div>

This is implemented. Hope this helps [Shortcodes | Zola #invocation-count](https://www.getzola.org/documentation/content/shortcodes/#invocation-count)

---

<div class="post-metadata">

**Author:** ![n0x4c](https://avatars.discourse-cdn.com/v4/letter/n/e274bd/32.png) [@n0x4c](https://zola.discourse.group/u/n0x4c)\
**Post date:** [March 28, 2021, 11:20pm UTC](https://zola.discourse.group/t/can-shortlinks-get-an-invocation-count-variable/671/3 "2021-03-28T23:20:07Z")

</div>

I know-- I’m the one who submitted the PR 🙂  
Thanks for linking the solution, hopefully it helps anyone who stumbles across this post in a web search!
