# Allow \`load\_data\` to take a literal?

**URL:** <https://zola.discourse.group/t/allow-load-data-to-take-a-literal/1165>\
**Category:** Feature requests\
**Created:** [February 2, 2022, 9:50am UTC](https://zola.discourse.group/t/allow-load-data-to-take-a-literal/1165 "2022-02-02T09:50:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Geobomatic](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/geobomatic/32/109_2.png) [@Geobomatic](https://zola.discourse.group/u/Geobomatic)\
**Post date:** [September 12, 2022, 12:15pm UTC](https://zola.discourse.group/t/allow-load-data-to-take-a-literal/1165/3 "2022-09-12T12:15:48Z")

</div>

Thanks for this PR!

is is possible to have some variable rendering in the “literal”?

```auto
{% macro print_tags(page) %}
{% set_global tags = [] %}

{% for t in page.taxonomies["tags"] %}
{% set s = t | slugify %}
{% set obj = load_data(literal='{ "slug": "{{s}}", "tag": "{{t}}" }', format="json") %}
{% set_global tags = tags | concat(with=obj) %}
{% endfor %}

{% for tag in tags | sort(attribute="slug") %}
<a href="/tags/{{ tag['slug'] }}" class="tag">{{ tag['tag'] }}</a>{% if not loop.last %}, {% endif %}
{% endfor %}

{% endmacro print_tags %}

```

gives me:

```auto
Error: Reason: Function call 'load_data' failed
Error: Reason: Error("expected `,` or `}`", line: 1, column: 18)

```

EDIT: I have a typo in my code, fixed but the variable doesn’t render ☹ (I ended with “{{t}}”)

EDIT2: worked around it!

```auto
{% macro print_tags(page) %}
{% set_global tags = [] %}
{% for t in page.taxonomies["tags"] %}
{% set s = t | slugify %}
{% set expanded_obj = '{ "slug": "' ~ s ~ '", "tag": "' ~ t ~ '" }' %}
{% set obj = load_data(literal=expanded_obj, format="json") %}
{% set_global tags = tags | concat(with=obj) %}
{% endfor %}
{% for tag in tags | sort(attribute="slug") %}
<a href="/tags/{{ tag['slug'] }}" class="tag">{{ tag['tag'] }}</a>{% if not loop.last %}, {% endif %}
{% endfor %}
{% endmacro print_tags %}

```

---

_[View the full topic](https://zola.discourse.group/t/allow-load-data-to-take-a-literal/1165)._
