CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.89k stars 1.6k forks source link

<.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site #974

Closed wagtale closed 6 months ago

wagtale commented 6 months ago

What happened?

github.com/CaiJimmy/hugo-theme-stack/v3 not working on cloudflare pages after release 3.24.1

Hugo version

v0.123.8

Theme version

v3.24.1

What browsers are you seeing the problem on?

No response

More information about the browser

No response

Relevant log output

<pre class="c_sm c_bv c_ux c_jj c_uv c_uw c_db c_wf c_ze c_zf c_zg c_ge c_gf c_yt c_bx c_zh" style="box-sizing: border-box; border-radius: 0px; color: rgb(49, 49, 49); display: block; font-size: 12px; margin: 0px; overflow: auto; padding: 16px 32px; width: 1015px; background-color: rgb(242, 242, 242); border-width: 0px 0px 1px; border-style: solid; border-color: rgb(217, 217, 217); border-image: initial; font-family: monaco, courier, monospace; height: 500px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">
ERROR render of "section" failed: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/_default/baseof.html:4:12": execute of template failed: template: _default/list.html:4:12: executing "_default/list.html" at <partial "head/head.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
--
14:59:37.051 | ERROR render of "term" failed: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/_default/baseof.html:4:12": execute of template failed: template: _default/list.html:4:12: executing "_default/list.html" at <partial "head/head.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
14:59:37.051 | Total in 3112 ms
14:59:37.051 | Error: error building site: render: failed to render pages: render of "home" failed: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/_default/baseof.html:4:12": execute of template failed: template: index.html:4:12: executing "index.html" at <partial "head/head.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/opt/buildhome/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/!cai!jimmy/hugo-theme-stack/v3@v3.24.0/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
14:59:37.063 | Failed: Error while executing user command. Exited with error code: 1
14:59:37.073 | Failed: build command exited with code: 1
14:59:37.992 | Failed: error occurred while running build command
</pre>

Link to Minimal Reproducible Example

CaiJimmy/hugo-theme-stack

DeepseaXX commented 6 months ago

Same thing happened to me since v3.24

DeepseaXX commented 6 months ago

I don't know if it works for you, but after I tried to apply changes from this commit, and changed HUGO_VERSION: 0.123.8 in github\workflows\hugo.yml, it turns to work.

CaiJimmy commented 6 months ago

v0.123.8

This error should not appear if you are using Hugo version >= 0.123.0. Check the Hugo version you are using in CloudFlare Page building process.

CaiJimmy commented 6 months ago

I don't know if it works for you, but after I tried to apply changes from this commit, and changed HUGO_VERSION: 0.123.8 in github\workflows\hugo.yml, it turns to work.

By default, GitHub action pulls the latest version of Hugo. Fixing a specific version is not recommended to do.

wagtale commented 6 months ago

Thanks changing the hugo version to 0.123.0 made it work.

lkaupp commented 5 months ago

For cloudflare pages, just manually specify the HUGO_VERSION variable in your environments: 0.125.3 Current version number can be found here: https://community.chocolatey.org/packages/hugo @CaiJimmy thanks for pointing this one out. It seems CFP uses an old outdated version of hugo out-of-the-box and you have to specify the new one if you want to get the latest version.

anemele commented 4 months ago

By default, GitHub action pulls the latest version of Hugo

I am sorry but the guide gives a fixed version: https://gohugo.io/hosting-and-deployment/hosting-on-github/#procedure at step 6.

wastu01 commented 4 months ago

last year it work, but I want to update my blog today, it show me that error. Hugo version v0.114.0 Theme version v3.24.1

➜  myblog git:(main) ✗ hugo -version
WARN  deprecated: --verbose was deprecated in Hugo v0.114.0 and will be removed in a future release. use --logLevel info
Start building sites … 
hugo v0.120.4-f11bca5fec2ebb3a02727fb2a5cfb08da96fd9df+extended darwin/arm64 BuildDate=2023-11-08T11:18:07Z VendorInfo=brew

INFO  copy static: syncing static files to /
INFO  build: running step process duration 3.171375ms
INFO  build: running step assemble duration 53.355208ms
INFO  deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in a future release. Use hugo.IsServer instead.
ERROR render of "home" failed: "/Users/larry/Github/hugo/myblog/layouts/_default/baseof.html:4:12": execute of template failed: template: index.html:4:12: executing "index.html" at <partial "head/head.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
ERROR render of "term" failed: "/Users/larry/Github/hugo/myblog/layouts/_default/baseof.html:4:12": execute of template failed: template: _default/list.html:4:12: executing "_default/list.html" at <partial "head/head.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
INFO  build: running step render duration 171.838708ms
INFO  build: running step postProcess duration 169.208µs
Total in 253 ms
Error: error building site: render: failed to render pages: render of "home" failed: "/Users/larry/Github/hugo/myblog/layouts/_default/baseof.html:4:12": execute of template failed: template: index.html:4:12: executing "index.html" at <partial "head/head.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/layouts/partials/head/head.html:15:4": execute of template failed: template: partials/head/head.html:15:4: executing "partials/head/head.html" at <partial "head/opengraph/include.html" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html:1:3": execute of template failed: template: partials/head/opengraph/include.html:1:3: executing "partials/head/opengraph/include.html" at <partial "head/opengraph/provider/base" .>: error calling partial: "/Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html:35:20": execute of template failed: template: partials/head/opengraph/provider/base.html:35:20: executing "partials/head/opengraph/provider/base.html" at <.Site.Lastmod.IsZero>: can't evaluate field Lastmod in type page.Site
➜  myblog git:(main) ✗ 
wastu01 commented 4 months ago

ok I fixed it by upgrading Hugo

➜  myblog git:(main) ✗ hugo version 
hugo v0.126.1+extended darwin/arm64 BuildDate=2024-05-15T10:42:34Z VendorInfo=brew
➜  myblog git:(main) ✗ hugo server -D              
Watching for changes in /Users/larry/Github/hugo/myblog/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /Users/larry/Github/hugo/myblog/config.yaml, /Users/larry/Github/hugo/myblog/themes/hugo-theme-stack/config.yaml
Start building sites … 
hugo v0.126.1+extended darwin/arm64 BuildDate=2024-05-15T10:42:34Z VendorInfo=brew

WARN  deprecated: .Site.IsServer was deprecated in Hugo v0.120.0 and will be removed in a future release. Use hugo.IsServer instead.

                   | ZH-TW  
-------------------+--------
  Pages            |   110  
  Paginator pages  |     6  
  Non-page files   |    67  
  Static files     |     6  
  Processed images |   133  
  Aliases          |    46  
  Cleaned          |     0  

Built in 15317 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) 
Press Ctrl+C to stop
^C%                                                                                  
➜  myblog git:(main) ✗