-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rendering breakage introduced in #665 #685
Fix rendering breakage introduced in #665 #685
Conversation
A bare bones setup of two pages and two posts gets broken because of a template change missed in theNewDynamic#665 Fatal error message in readable form: ``` ERROR render: failed to render pages: render of "home" failed: "/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 ``` Steps to reproduce: ```shell hugo new site quickstart cd quickstart git init git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke echo "theme = 'ananke'" >> hugo.toml echo -e "+++\ntitle='Home'\n+++\n\nMain page" > content/_index.md echo Foo. > content/page1.md echo Bar > content/page2.md mkdir -p content/post echo "First post." > content/post/post1.md echo "Second post." > content/post/post2.md hugo server Watching for changes in .../quickstart/{archetypes,assets,content,data,i18n,layouts,static,themes} Watching for config changes in .../quickstart/hugo.toml, ...quickstart/themes/ananke/config.yaml Start building sites … hugo v0.125.3-474c4c02212cf97712c6fbf4159c68822ea6e078+extended darwin/amd64 BuildDate=2024-04-22T17:18:35Z VendorInfo=brew Built in 67 ms Error: error building site: render: failed to render pages: render of "home" failed: ".../quickstart/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 ```
✅ Deploy Preview for gohugo-ananke-theme-demo canceled.
|
If you run a preview of the example site, you will encounter the same error. |
We just had the first report of this on the Hugo forum. Hugo's quick start guide currently instructs users to install Ananke, so they're going to run into a dead end. I haven't reviewed this PR or #665, but in the short term I'd be inclined to simply revert f34c219. |
I can confirm, that this (very simple) PR fixed the issue. In my case, when I had 4 and more pages in a section, the generation was failing (as it attempts to do some "see all pages" etc.). |
I can testify that this issue breaks the website rendering. In the meantime, is there a way to statically set the version of the theme I use in order to fix the build? |
@oupala If you've added the theme to your Hugo project as a git submodule, you can:
|
I don't think I have added the theme as a submodule I'm using the following method to add the theme:
with a I think the
|
Your go.mod file should then look like:
|
@jmooring It looks like this workaround does not work:
and I still get the same error in the build:
|
@oupala please don't hijack this issue's comments for personalized support for deploying Hugo and its themes. |
I ran into the same issue (sorry oupala not the same one you have) and independently found the same solution. This PR fixed the issue and is an easy win. |
Sorry about the delay. And thanks for the fix. |
A bare bones setup of two pages and two posts gets broken because of a template change missed in #665 Fatal error message in readable form: ``` ERROR render: failed to render pages: render of "home" failed: "/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 ``` Steps to reproduce: ```shell hugo new site quickstart cd quickstart git init git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke echo "theme = 'ananke'" >> hugo.toml echo -e "+++\ntitle='Home'\n+++\n\nMain page" > content/_index.md echo Foo. > content/page1.md echo Bar > content/page2.md mkdir -p content/post echo "First post." > content/post/post1.md echo "Second post." > content/post/post2.md hugo server Watching for changes in .../quickstart/{archetypes,assets,content,data,i18n,layouts,static,themes} Watching for config changes in .../quickstart/hugo.toml, ...quickstart/themes/ananke/config.yaml Start building sites … hugo v0.125.3-474c4c02212cf97712c6fbf4159c68822ea6e078+extended darwin/amd64 BuildDate=2024-04-22T17:18:35Z VendorInfo=brew Built in 67 ms Error: error building site: render: failed to render pages: render of "home" failed: ".../quickstart/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 ```
A bare bones setup of two pages and two posts gets broken because of a template change missed in #665
Fatal error message in readable form:
Steps to reproduce:
Output: