this code prevents Hugo server to start. Setting timeout limit in config not helping. I have over 200 posts with this shortcode.
There is no error with less posts using this shortcode.
Error:
timed out initializing value. You may have a circular loop in a shortcode, or your site may have resources that take longer to build than the `timeout` limit in your Hugo config file.
I don’t see this in your snippet, but the “circular loop” in question is when you in a shortcode end up including yourself …
So, in a shortcode
{{ .Page.Content }} returns a blank string for this reason.
{{ (site.GetPage .Page.Path).Content }} (assuming I got it right) will end up in an infinite recursion.
As I said, I’m not sure what’s happening in your situation, but I suspect it’s something we’re not seeing. Do you have the source somewhere for people to look at? (e.g. GitHub).
.Page.Content isn’t used in this shortcode, only Front Matter data and general site settings. All posts have relevant Front Matter data.
Do you think {{- with .Site.GetPage $path }} is too complex way for this shortcode. Is there any alternative to this solution, or should I come back to fetch various data from .Get shortcode fields typed manually? (manually typed page title, image link, description etc. works).
Each post has facy link to other content (other post) thanks to this shortcode - which is placed inside post content. First version of the shortcode needed to put title, summary, image data manually and I thought that I could make the process easier for the user, who would just put URL of the other interesting post.
I think I will come back to the first “manual” version as Hugo aren’t able to manage this code.
All data where used in the past, but now wanted to simplified the shortcode, so only URL is used and other data fetched automatically. As you can see unused bookmark data are e.g. title, description. Do you think it would cause the confict with Front Matter “Title” setting of the bookmarked post and .GetPage function for instance?
It is Summary that cause the error. It has no shortcode. I removed some symbols from posts Summary, but still Hugo freezes. Is there any way to check what causes the Hugo freeze exactly?
Have you tried using plainify or safeHTML for the .summary ?
I’d love to learn more about debugging also but I’ve managed so far by doing things like starting with a minimal working set of content and then adding more in small amounts.