Skip to content

Render not triggered from modifying file pulled in by readFile #13823

Open
@BBaoVanC

Description

@BBaoVanC

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.147.8+extended+withdeploy linux/amd64 BuildDate=unknown

Does this issue reproduce with the latest release?

Yes


I have a shortcode called "include" which I'm using to pull in a shared info box that I include on multiple articles:

{{ $path := "" }}
{{ $markdown := false }}
{{ if .IsNamedParams }}
    {{ $path = .Get "path" }}
    {{ with .Get "markdown" }}
        {{ $markdown = . }}
    {{ end }}
{{ else }}
    {{ $path = .Get 0 }}
{{ end }}

{{ with ($path | readFile) }}
    {{ if $markdown }}
        {{ $path | readFile | $.Page.RenderString (dict "display" "block") }}
    {{ else }}
        {{ $path | readFile }}
    {{ end }}
{{ else }}
    {{ errorf "file not found: %s" $path }}
{{ end }}

It seems that when using hugo serve, modifying the file that's being passed to readFile (the shared snippet) doesn't trigger a rerender and I have to restart the Hugo server entirely.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions