htmlzola

How to hyperlink templates specific file on index.html in Zola


I am trying to hyperlink gallery.html located in the templates folder at the index.html at Zola.

Structure of the project

content
templates
  - gallery.html
  - index.html
  - base.html
static
config.toml

I tried to use link_to it didn't work to link.

<a href="{{ link_to("gallery.html") }}">Gallery</a>.

Solution

  • Zola does not have a link_to() function. To add a hyperlink to the gallery you need to target gallery’s template output file (in the content directory) and not the template.

    index.html:

    <a href="{{ get_url(path="@/pages/gallery.md") }}">Gallery</a>
    

    See Zola’s internal linking.