# Page-wide data? Shortcodes/Macros?

**URL:** <https://zola.discourse.group/t/page-wide-data-shortcodes-macros/2340>\
**Category:** Support\
**Created:** [October 25, 2024, 1:14pm UTC](https://zola.discourse.group/t/page-wide-data-shortcodes-macros/2340 "2024-10-25T13:14:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![l-mb](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/l-mb/32/1343_2.png) [@l-mb](https://zola.discourse.group/u/l-mb)\
**Post date:** [October 25, 2024, 1:14pm UTC](https://zola.discourse.group/t/page-wide-data-shortcodes-macros/2340/1 "2024-10-25T13:14:37Z")

</div>

Hi all,  
I’m exploring Zola and currently playing around with adapting [Using BibTeX for referencing in Zola | hertig.blog](https://hertig.blog/posts/using-bibtex-for-referencing-in-zola/) for my needs.

One thing I’d like to do is to

```auto
{% set citations = load_data(path= "references.bib", format="bibtex", required=false) %}

```

in my `page.html` template as part of the header, and then reference that dictionary in my shortcodes use in my content including the ability to modify it), so that I can then render the page footer dynamically (e.g., counting how often a reference was used, greying out unused ones, etc).

Now, this … kinda works within the `page.html` template: the citations dictionary is visble in later code blocks (I’m extending `comments_init` and `page_footer` from the abridge theme).

But in the shortcode, the `citations` dict is just invisible.

Am I running into the consequences of `Shortcodes are rendered before the page's Markdown is parsed so they don't have access to the page's table of contents.`?

The docs say that I should use macros if I want more than that; but I also can’t use macros in my markdown, so something like `{{ ref::cite(key="foo") }}` is also just rendered as plain text in the output.

If so, how can I work around this? Is that possible at all?

(I did find [Include `macro` in content - #5 by HugoTrentesaux](https://zola.discourse.group/t/include-macro-in-content/1693/5) but am not sure how to wrap that.)

---

<div class="post-metadata">

**Author:** ![l-mb](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/l-mb/32/1343_2.png) [@l-mb](https://zola.discourse.group/u/l-mb)\
**Post date:** [October 25, 2024, 1:53pm UTC](https://zola.discourse.group/t/page-wide-data-shortcodes-macros/2340/2 "2024-10-25T13:53:22Z")

</div>

Replying to myself: [Any way to have a global variable across shortcodes?](https://zola.discourse.group/t/any-way-to-have-a-global-variable-across-shortcodes/1875) Sorry for missing this previously.

So yeah, shortcodes are out. But it seems a fairly common request to have a mechanism for?
