# Inconsistent behaviour with get\_url and components

**URL:** <https://zola.discourse.group/t/inconsistent-behaviour-with-get-url-and-components/2983>\
**Category:** Support\
**Created:** [October 6, 2026, 10:35am UTC](https://zola.discourse.group/t/inconsistent-behaviour-with-get-url-and-components/2983 "2026-10-06T10:35:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aarcane](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/aarcane/32/1660_2.png) [@aarcane](https://zola.discourse.group/u/aarcane)\
**Post date:** [October 6, 2026, 10:35am UTC](https://zola.discourse.group/t/inconsistent-behaviour-with-get-url-and-components/2983/1 "2026-10-06T10:35:35Z")

</div>

Hi all, working on a small personal site with zola, and needed a simple image tag, more than the standard `![xx](...)` but less than the built in image component from my theme. So I wrote this little ditty that accepts either a path or a url, adds an alt, and a simple class.

```twig
{% component aimage(alt: string, url: string="", path: string="", class: string="", @config) %}
{% if (url == "" and path == "") or (url != "" and path != "") %}
{{ throw(message = "Requires either url or path, but not both") }}
{% elif path != "" %}
{% set img_url = get_url(path=path, cachebust=true) %}
{% elif url != "" %}
{% set img_url = url | escape_html %}
{% endif %}
<img src="{{img_url}}" alt="{{alt|escape_html}}" class="{{class | escape_html }}" {% if config.markdown.lazy_async_image %} decoding="async" loading="lazy" {% endif %} />
{% endcomponent %}

```

and I noticed something interesting while testing it. Look at these four lines:

```twig
{{<aimage path='@/cookies/anubis.webp' alt="A picture of anubis" class="cookies" />}}
{{<aimage url='/cookies/anubis.webp' alt="A picture of anubis" class="cookies" />}}
{{<aimage url={get_url(path='@/cookies/anubis.webp', cachebust=true)} alt="A picture of anubis" class="cookies" />}}
<img src="{{get_url(path='/cookies/anubis.webp', cachebust=true)}}" alt="A picture of anubis" class="cookies" />

```

In _theory_, three should produce the exact same line, and 1 should just be a link to the image, unmodified. However, this is the output that gets rendered:

```xml
<img src="http://127.0.0.1:1111/cookies/anubis.webp" alt="A picture of anubis" class="cookies" />
<img src="/cookies/anubis.webp" alt="A picture of anubis" class="cookies" />
<img src="http://127.0.0.1:1111/cookies/anubis.webp" alt="A picture of anubis" class="cookies" />
<img src="http://127.0.0.1:1111/cookies/anubis.webp?h=7eaf5ecd666f0a53978c" alt="A picture of anubis" class="cookies" />

```

Only one of them has a properly cachebust’ URL, even though three of them were rendered with `cachebust=true`.

Here’s some extra data, and I’ll provide anything else you ask for tomorrow when I get on.

```bash
PS C:\Users\aarcane\Workspace\website-2027> zola --version
zola 0.23.6
PS C:\Users\aarcane\Workspace\website-2027> zola serve
Building site...
-> Creating 7 pages (0 orphan) and 3 sections
Done in 451ms.

Listening for changes in \\?\C:\Users\aarcane\Workspace\website-2027\{zola.toml,content,sass,static,templates,themes}
Press Ctrl+C to stop

Web server is available at http://127.0.0.1:1111/ (bound to 127.0.0.1:1111)

```

installed with `$ winget install getzola.zola`.

Other than that, I’m loving working with Zola so far! The website documentation could use some updates, but it’s pretty excellent! Thanks for the great project!
