I updated to 0.127.0 to play around with live reloading from a remote resource and thought I would try to get output from an RSS feed displayed on my site and updating automatically. This worked great when running my site with “hugo server” but updates stopped happening on my site when I built it to serve with nginx. I think this is because I may be lacking understanding in some core concepts.
I created a ttrsspull.html file under layouts/shortcodes to parse the output of ttrss XML:
{{ if .Get "url" }}
{{ $url := .Get "url" }}
{{ $limit := .Get "limit" }}
<div class="py-8">
{{ with resources.GetRemote $url | transform.Unmarshal }}
{{ range first $limit .entry }}
<div class="grid grid-cols-1 md:grid-cols-2 bg-white shadow-lg border border-gray-200 rounded-lg p-4 cursor-pointer mb-6 md:mb-10" >
<div class="flex flex-col p-4">
<h2 class="text-xl font-semibold"><a href="{{ index .link "-href" }}" target="_blank">{{ index .title "#text" }}</a></h2>
<p class="text-slate-400 muted text-sm">Author: {{ .author.name }}</p>
<p class="text-slate-400 muted text-sm">{{ index .link "-href" }}</p>
<p class="text-slate-400 muted text-sm">{{ dateFormat "January 2, 2006" .source.updated }}</p>
{{/* <p class="text-slate-400 muted text-sm">{{ .link }}</p> */}}
</div>
<div class="flex justify-center items-center">
{{ with .enclosure }}
{{ $url := index . "-url" }}
<img src="{{ $url }}" alt="{{ .title }}" class="object-contain max-h-72 rounded-xl" style="border-radius: 20px;">
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
and called it from an md file in my content directory:
{{< ttrsspull url="https://path/to/xml" limit="5" >}}
and I thought the magic to make it work was in the config.toml file:
[httpcache]
[httpcache.cache]
[httpcache.cache.for]
includes = ['https://path/to/xml']
[[httpcache.polls]]
low = '1s'
high = '30s'
[httpcache.polls.for]
includes = ['https://path/to/xml']
but I am missing something as it does not update when the RSS XML updates after I build the site (but it does work in my dev environment using hugo server). Can someone point me in the right direction on what I should be configuring?