Resource Caching of .md files

I’m using the following as a shortcode for importing one markdown file into another. It seems to work great; however, the only way that I can get it to update with hugo server after modifying the ‘imported’ markdown file is to restart the server.

I’ve tried:

I can’t disable all caches via --ignoreCache due to that triggering an image generation bug, although I’m guessing that wouldn’t fix it if disabling the assets cache didn’t do it.

{{- $file := .Get 0 -}}
{{- with (.Page.Site.GetPage "media").Resources.GetMatch $file -}}
    {{- .Content -}}
{{- end -}}

Any other ideas?

Oh, I think this related to the shortcode behavior. Basically the shortcode result is cached and the page doesn’t refresh unless the page’s .md file gets re-saved. Probably not possible to work around, other than with a server-restart script?

Semi-related:

Smells like https://github.com/gohugoio/hugo/issues/8863

1 Like