I am using this example I found on github: GitHub - colmjude/hugo-data-template-tutorial
This is my JSON content: JSON Blob | 976078075460861952
I saved this JSON file in: /data/one/source.json
I modified 2 files in the example above. The modified content is. project-root/layouts/verbs/list.html
:
{{ define "main" }}
<ul>
{{ range .Data.Pages }}
<li>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ul>
{{ end }}
and project-root/layouts/verbs/single.html
:
<!-- Data is in /data/one/source.json -->
{{ define "main" }}
<div class="nested-copy-line-height lh-copy f4 nested-links nested-img mid-gray">
{{ .Content }}
</div>
<h2>Data</h2>
{{ range (index .Site.Data.one .File.BaseFileName).ayas }}
<!-- sura_name -->
<p>{{ .identifier.sura_name }}</p>
<!-- everything from 'theme' -->
<p>{{ .theme.chapter }}</p>
<p>{{ .theme.topic }}</p>
<p>{{ .theme.subtopic }}</p>
<!-- [aya][text] -->
<p>{{ .aya.text | safeHTML}}</p>
<!-- [aya][translation] -->
<p>{{ .aya.translation | safeHTML}}</p>
{{ end }}
{{ end }}
What works: the list.html
page
What doesn’t work: clicking on any page in list.html
. The pages just return blank. No content whatsoever.
My goal is to render each JSON document as its own HTML page containing some data extracted from each JSON document.