Skip to content

How to embed an svg in a template from a local file (include and load_data don't seem to work for this) #2029

Open
@rib

Description

@rib

Documentation issue

Summary

Hi, I'm trying to switch my blog over to using Zola, and something I was doing previously was directly embedding a few svgs (for social media icons) which I can't figure out how to do currently with Tera's include directive or via set data = load_data()

When I try to something like {% include "github.svg" %} (and trying lots of alternative locations for the svg) it seems to always report an error like:

Error: Reason: Failed to render 'post-page.html'
Error: Reason: Template '[github.svg]' not found

If I instead try something like:

          {% set data = load_data(path="github.svg", format="xml") %}
          <div class="icon">{{ data }}</div>

the generated output will just substitute [object] for that data.

It would be good if there were some documentation that could show how it's possible include / embed xml/svg data within a template.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions