Skip to content
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

"ERROR ... render of "taxonomy" failed ... can't evaluate field Ancestors in type *hugolib.pageState" #24

Closed
kirisakow opened this issue Apr 8, 2023 · 12 comments

Comments

@kirisakow
Copy link

kirisakow commented Apr 8, 2023

  1. I followed the tutorial in this project's README file.
  2. Then I ran hugo server --debug and here's what I got in return:
$ hugo server --debug 
WARN 2023/04/08 21:33:44 Module "github.com/willfaught/paige" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Start building sites … 
hugo v0.102.3+extended linux/amd64 BuildDate=2022-09-13T20:32:22Z VendorInfo=ubuntu:0.102.3-1ubuntu1
INFO 2023/04/08 21:33:44 syncing static files to /
DEBUG 2023/04/08 21:33:44 Render page My New Hugo Site to "/index.html"
DEBUG 2023/04/08 21:33:44 Render page Categories to "/categories/index.html"
DEBUG 2023/04/08 21:33:44 Render page Tags to "/tags/index.html"
ERROR 2023/04/08 21:33:44 render of "taxonomy" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/_default/baseof.html:14:23": execute of template failed: template: _default/taxonomy.html:14:23: executing "_default/taxonomy.html" at <partial "paige/header.html" $page>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/partials/paige/header.html:3:14": execute of template failed: template: partials/paige/header.html:3:14: executing "partials/paige/header.html" at <$page.Ancestors>: can't evaluate field Ancestors in type *hugolib.pageState
ERROR 2023/04/08 21:33:44 render of "taxonomy" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/_default/baseof.html:14:23": execute of template failed: template: _default/taxonomy.html:14:23: executing "_default/taxonomy.html" at <partial "paige/header.html" $page>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/partials/paige/header.html:3:14": execute of template failed: template: partials/paige/header.html:3:14: executing "partials/paige/header.html" at <$page.Ancestors>: can't evaluate field Ancestors in type *hugolib.pageState
Error: Error building site: failed to render pages: render of "home" failed: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/_default/baseof.html:14:23": execute of template failed: template: _default/home.html:14:23: executing "_default/home.html" at <partial "paige/header.html" $page>: error calling partial: "/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/willfaught/paige@v0.56.2/layouts/partials/paige/header.html:3:14": execute of template failed: template: partials/paige/header.html:3:14: executing "partials/paige/header.html" at <$page.Ancestors>: can't evaluate field Ancestors in type *hugolib.pageState
Built in 475 ms
  1. Then, as recommended, I ran hugo mod graph and here's what I got in return:
$ hugo mod graph 
WARN 2023/04/08 21:34:14 Module "github.com/willfaught/paige" is not compatible with this Hugo version; run "hugo mod graph" for more information.
github.com/kirisakow/XXXXXXXXXXXX github.com/willfaught/paige@v0.56.2
@kirisakow kirisakow changed the title "Module "github.com/willfaught/paige" is not compatible with this Hugo version; run "hugo mod graph" for more information." "ERROR ... render of "taxonomy" failed ... can't evaluate field Ancestors in type *hugolib.pageState" Apr 8, 2023
@willfaught
Copy link
Owner

The issue seems to be this:

WARN 2023/04/08 21:33:44 Module "github.com/willfaught/paige" is not compatible with this Hugo version; run "hugo mod graph" for more information.

You need Hugo v0.111.3.

What does hugo env print?

@kirisakow
Copy link
Author

$ hugo env 
hugo v0.102.3+extended linux/amd64 BuildDate=2022-09-13T20:32:22Z VendorInfo=ubuntu:0.102.3-1ubuntu1
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.19"

@willfaught
Copy link
Owner

Someone else encountered the Ancestors error:

#23

Their issue seemed to be an invalid site, somehow. When they started a new site from scratch, the issue went away. Do you see this error for a new site?

@willfaught
Copy link
Owner

I've added a note about the minimum Hugo version: 36c123f

@willfaught
Copy link
Owner

It looks like you need to upgrade Hugo to the latest version. You also need to install dart-sass-embedded. I'm not sure either of those things are related to the Ancestors error, though.

@kirisakow
Copy link
Author

kirisakow commented Apr 8, 2023

Do you see this error for a new site?

It is a new (blank) website I just created with this tutorial of yours.

@kirisakow
Copy link
Author

The issue seems to be this:

WARN 2023/04/08 21:33:44 Module "github.com/willfaught/paige" is not compatible with this Hugo version; run "hugo mod graph" for more information.

You need Hugo v0.111.3.

Indeed, right now I have

$ apt list --installed | grep hugo

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

hugo/kinetic,now 0.102.3-1ubuntu1 amd64 [installed]

Fortunately, snap has a more up-to-date version:

$ snap find hugo
Name            Version  Publisher     Notes  Summary
hugo            0.111.3  hugo-authors  -      Fast and Flexible Static Site Generator

@willfaught
Copy link
Owner

Please report back when you've tried it with Hugo 0.111.3 and dart-sass-embedded.

I don't see that error on macOS using the setup instructions:

~
❯ hugo new site yourproject
Congratulations! Your new Hugo site is created in /Users/Will/yourproject.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/ or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.

~
❯ cd yourproject/

~/yourproject
❯ hugo new yourpost.md
Content "/Users/Will/yourproject/content/yourpost.md" created

~/yourproject
❯ hugo mod init github.com/youraccount/yourproject
go: creating new go.mod: module github.com/youraccount/yourproject
go: to add module requirements and sums:
	go mod tidy

~/yourproject
❯ hugo mod get github.com/willfaught/paige
go: downloading github.com/willfaught/paige v0.56.2
go: added github.com/willfaught/paige v0.56.2

~/yourproject
❯ bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ cat >>config.toml <<EOF
> [[module.imports]]
> path = "github.com/willfaught/paige"
> EOF
bash-3.2$ exit

~/yourproject
❯ hugo server -D
port 1313 already in use, attempting to use an available port
Start building sites … 
hugo v0.111.3+extended darwin/amd64 BuildDate=unknown

                   | EN  
-------------------+-----
  Pages            |  8  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     | 95  
  Processed images |  0  
  Aliases          |  1  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 988 ms
Watching for changes in /Users/Will/yourproject/{archetypes,assets,content,data,layouts,static}
Watching for config changes in /Users/Will/yourproject/config.toml, /Users/Will/yourproject/go.mod
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:54564/ (bind address 127.0.0.1)
Press Ctrl+C to stop

Can you show me your commands for creating the site, and the contents of your config.toml?

@willfaught
Copy link
Owner

Ah, the Ancestors field was added in Hugo 0.110.0. Upgrading should fix this.

@kirisakow
Copy link
Author

Sorry, I was busy coping with a well-known Snap's shortcoming, finding a workaround, then raising awareness about that among Hugo project maintainers: gohugoio/hugoDocs#2049

@willfaught
Copy link
Owner

willfaught commented Apr 8, 2023

No worries. Thanks for reporting the Snap issue to the Hugo project!

@willfaught
Copy link
Owner

Since the cause is now understood, and the fix is to upgrade Hugo, I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants