I’m using the following shortcode to create article previews:
{{$linktext := .Get 0}}
{{$page := .Site.GetPage (.Get 1)}}
<a class="internal-link" href="{{$page.RelPermalink}}" alt="{{$page.Title}}">{{$linktext}}</a>
<span class="link-preview">
<span class="link-title">{{$page.Title}}<br></span>
<span class="link-summary">{{$page.Summary | plainify }}</span>
</span>
When I use this shortcode, if I have any posts that reference each other (e.g. Page A has a link to Page B and Page B has a link to Page A), hugo throws the following 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.
It appears that {{$page.Summary}} is the culprit; if I remove this from my shortcode, Hugo builds and serves without issue. (Manually adding summary content in the frontmatter doesn’t seem to solve the problem, either.)
Does anyone know a)why this is happening, b)how I can better diagnose it, or c)how to fix it?