Mysterious HREF (and SRC) corrector in Hugo
This is a reconstruction of the automatic URL corrections happening inside HREF (and SRC) attributes and not some others while rendering static website using HUGO.
Created as an illustration for my post on the HUGO support forum.
The behavior I call mysterious (didn't find it described in the HUGO Docs) is:
I'm inserting similar URLs in a few HTML attributes - using a variable containing a string created earlier, representing an URL of a page resource. That URL is relative to the site's base URL: "/comics/comics-1/img/image1-featured-thumb.jpg" (was created using the relURL function).
After rendering the HTML the attributes designed for URLs got their values corrected to URLs that are relative to the page's (comics-1) path:
while the same URL was left unchanged in other (custom) attributes:
And this happens by default - without any CanonifyURLs or similar turned on in the config.
I miss this described somewhere so I can understand what's going on and take it into account when creating my templates.