If I copy a post from content/posts, and then paste it into the same directory, it appears on the site as normal. But if I paste it three times or more, it gives this error:
render: failed to render pages: render of "home" failed: e[1;36m"/Users/testuser/Desktop/hugo/themes/ananke/layouts/index.html:48:23"e[0m: execute of template failed at <.Site.GetPage>: can’t evaluate field Site in type string
/Users/testuser/Desktop/hugo/themes/ananke/layouts/index.html:48:23:
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
{{ with .Site.GetPage "section" $section_name }}
<a href="{{ .RelPermalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
{{ end }}
hugo v0.125.4+extended darwin/amd64 BuildDate=2024-04-25T13:27:26Z VendorInfo=brew
However, if I delete the third post that I pasted, the error goes away, and the other pasted posts appear as expected with no errors:
@jmooring , Yes I’ve tried when server is running and not running. The server won’t even start if I add/paste the third post and then run “hugo server -D”. It gives error:
~/Desktop/hugo$ hugo server -D
Watching for changes in /Users/testuser/Desktop/hugo/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /Users/testuser/Desktop/hugo/hugo.toml, /Users/testuser/Desktop/hugo/themes/ananke/config.yaml
Start building sites …
hugo v0.125.4+extended darwin/amd64 BuildDate=2024-04-25T13:27:26Z VendorInfo=brew
Built in 113 ms
Error: error building site: render: failed to render pages: render of "home" failed: "/Users/testuser/Desktop/hugo/themes/ananke/layouts/index.html:48:23": execute of template failed: template: index.html:48:23: executing "main" at <.Site.GetPage>: can't evaluate field Site in type string
And don’t make any more changes to the files in themes/. Instead, override them by creating a copy in the same path relative to your site root (e.g., override themes/ananke/layouts/foo.html by creating layouts/foo.html).