To include the image I’m using the shortcode in e.g. post1/index.md:
{{< image path=image1.jpg >}}
This works as expected when building the page.
However, when I run hugo server or hugo -w and add a new post as page bundle, hugo complains that the image does not exist (.Page.Resources.Get ($u.Path) is NIL).
When restarting hugo, everything is rendered as expected.
Why is it rendered correctly on first run, but not when changes are detected?
It tried the embedded figure shortcode. With this I have the same behaviour: If content is available on hugo server start, the image is shown correctly. If the content is added during running hugo, the image is not shown.
The generated html page differs.
Working code after hugo restart:
<figure class="ma0 w-75"><a href="https://www.nps.gov/zion/index.htm"><img src="/posts/figure_test/image.jpg"
alt="A photograph of Zion National Park"></a><figcaption>
<p>Zion National Park</p>
</figcaption>
</figure>
Not working solution after automatic rebuild:
<figure class="ma0 w-75"><a href="https://www.nps.gov/zion/index.htm"><img src="image.jpg"
alt="A photograph of Zion National Park"></a><figcaption>
<p>Zion National Park</p>
</figcaption>
</figure>
The src content differ. This means that .RelPermalink is calculated incorrectly.
Starting with the example below, please provide the steps to reproduce the problem:
git clone --single-branch -b hugo-forum-topic-55737 https://github.com/jmooring/hugo-testing hugo-forum-topic-55737
cd hugo-forum-topic-55737
hugo server