HUGO

Is it possible to process dynamic Hugo commands and data (with {{ ... }}) in content/*.html pages?

I’m trying retrieve and process images within content/*.html pages (e.g. content/_index.html) and the content between the {{ ... }} delimiters are rendering as strings instead of being processed by Hugo.

Here’s the contents of my content/_index.html page:

---
title: "Title"
date: 2021-10-04T08:25:23-04:00
draft: false
---

<main>
  {{- $image := resources.Get "images/example.jpg" -}}
</main>

In the DOM, I’m seeing this:

<main>
  {{- $image := resources.Get "images/example.jpg" -}}
</main>

What am I missing?

https://discourse.gohugo.io/t/template-not-rendering/33433/2

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.