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

Can not build website locally due to missing font source in ogimage template #208

Closed
yuvipanda opened this issue Jan 12, 2024 · 4 comments · Fixed by #209
Closed

Can not build website locally due to missing font source in ogimage template #208

yuvipanda opened this issue Jan 12, 2024 · 4 comments · Fixed by #209
Assignees

Comments

@yuvipanda
Copy link
Member

I'm trying to build the website off a clean checkout in main and it's failing:

$ ./hugo
Start building sites … 
hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended darwin/arm64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio
ERROR 2024/01/11 22:36:44 render of "page" failed: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/_default/baseof.html:7:3": execute of template failed: template: widget_page/single.html:7:3: executing "widget_page/single.html" at <partial "site_head" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/partials/site_head.html:191:5": execute of template failed: template: partials/site_head.html:191:5: executing "partials/site_head.html" at <partial "wowchemy_seo" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/wowchemy_seo.html:6:3": execute of template failed: template: partials/wowchemy_seo.html:6:3: executing "partials/wowchemy_seo.html" at <partial "seo_tags" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/seo_tags.html:61:22": execute of template failed: template: partials/seo_tags.html:61:22: executing "partials/seo_tags.html" at <partial "functions/get_featured_image.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/functions/get_featured_image.html:31:11": execute of template failed: template: partials/functions/get_featured_image.html:31:11: executing "partials/functions/get_featured_image.html" at <partial "partials/ogimage.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/ogimage.html:10:39": execute of template failed: template: partials/ogimage.html:10:39: executing "partials/ogimage.html" at <images.Text>: error calling Text: invalid text font source: <nil>
ERROR 2024/01/11 22:36:44 render of "page" failed: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/_default/baseof.html:7:3": execute of template failed: template: widget_page/single.html:7:3: executing "widget_page/single.html" at <partial "site_head" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/partials/site_head.html:191:5": execute of template failed: template: partials/site_head.html:191:5: executing "partials/site_head.html" at <partial "wowchemy_seo" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/wowchemy_seo.html:6:3": execute of template failed: template: partials/wowchemy_seo.html:6:3: executing "partials/wowchemy_seo.html" at <partial "seo_tags" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/seo_tags.html:61:22": execute of template failed: template: partials/seo_tags.html:61:22: executing "partials/seo_tags.html" at <partial "functions/get_featured_image.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/functions/get_featured_image.html:31:11": execute of template failed: template: partials/functions/get_featured_image.html:31:11: executing "partials/functions/get_featured_image.html" at <partial "partials/ogimage.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/ogimage.html:10:39": execute of template failed: template: partials/ogimage.html:10:39: executing "partials/ogimage.html" at <images.Text>: error calling Text: invalid text font source: <nil>
ERROR 2024/01/11 22:36:44 render of "page" failed: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/_default/baseof.html:7:3": execute of template failed: template: widget_page/single.html:7:3: executing "widget_page/single.html" at <partial "site_head" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/partials/site_head.html:191:5": execute of template failed: template: partials/site_head.html:191:5: executing "partials/site_head.html" at <partial "wowchemy_seo" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/wowchemy_seo.html:6:3": execute of template failed: template: partials/wowchemy_seo.html:6:3: executing "partials/wowchemy_seo.html" at <partial "seo_tags" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/seo_tags.html:61:22": execute of template failed: template: partials/seo_tags.html:61:22: executing "partials/seo_tags.html" at <partial "functions/get_featured_image.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/functions/get_featured_image.html:31:11": execute of template failed: template: partials/functions/get_featured_image.html:31:11: executing "partials/functions/get_featured_image.html" at <partial "partials/ogimage.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/ogimage.html:10:39": execute of template failed: template: partials/ogimage.html:10:39: executing "partials/ogimage.html" at <images.Text>: error calling Text: invalid text font source: <nil>
ERROR 2024/01/11 22:36:44 render of "page" failed: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/_default/baseof.html:7:3": execute of template failed: template: widget_page/single.html:7:3: executing "widget_page/single.html" at <partial "site_head" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/partials/site_head.html:191:5": execute of template failed: template: partials/site_head.html:191:5: executing "partials/site_head.html" at <partial "wowchemy_seo" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/wowchemy_seo.html:6:3": execute of template failed: template: partials/wowchemy_seo.html:6:3: executing "partials/wowchemy_seo.html" at <partial "seo_tags" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/seo_tags.html:61:22": execute of template failed: template: partials/seo_tags.html:61:22: executing "partials/seo_tags.html" at <partial "functions/get_featured_image.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/functions/get_featured_image.html:31:11": execute of template failed: template: partials/functions/get_featured_image.html:31:11: executing "partials/functions/get_featured_image.html" at <partial "partials/ogimage.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/ogimage.html:10:39": execute of template failed: template: partials/ogimage.html:10:39: executing "partials/ogimage.html" at <images.Text>: error calling Text: invalid text font source: <nil>
Error: Error building site: failed to render pages: render of "page" failed: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/_default/baseof.html:7:3": execute of template failed: template: _default/single.html:7:3: executing "_default/single.html" at <partial "site_head" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/[email protected]/layouts/partials/site_head.html:191:5": execute of template failed: template: partials/site_head.html:191:5: executing "partials/site_head.html" at <partial "wowchemy_seo" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/wowchemy_seo.html:6:3": execute of template failed: template: partials/wowchemy_seo.html:6:3: executing "partials/wowchemy_seo.html" at <partial "seo_tags" .>: error calling partial: "/var/folders/p4/gnx7h_mj73v92nj_v93475v80000gn/T/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-themes/modules/[email protected]/layouts/partials/seo_tags.html:61:22": execute of template failed: template: partials/seo_tags.html:61:22: executing "partials/seo_tags.html" at <partial "functions/get_featured_image.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/functions/get_featured_image.html:31:11": execute of template failed: template: partials/functions/get_featured_image.html:31:11: executing "partials/functions/get_featured_image.html" at <partial "partials/ogimage.html" .>: error calling partial: "/Users/yuvipanda/code/2i2c-org.github.io/layouts/partials/ogimage.html:10:39": execute of template failed: template: partials/ogimage.html:10:39: executing "partials/ogimage.html" at <images.Text>: error calling Text: invalid text font source: <nil>
Total in 368 ms

This is with the version of hugo specified in netlify.toml and the GitHub action:

hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371+extended darwin/arm64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio

Using a newer hugo (v0.120) also fails.

@yuvipanda
Copy link
Member Author

This is a problem because I'd like to publish this blog post but can't: #205

@yuvipanda yuvipanda changed the title Can not build website Can not build website locally Jan 12, 2024
@yuvipanda
Copy link
Member Author

Ah, so it works on netlify but not locally or on GH actions

@yuvipanda
Copy link
Member Author

This is less urgent now, because I can use the netlify previews to see it. Still something we should fix one way or another though.

@choldgraf choldgraf changed the title Can not build website locally Can not build website locally due to failing ogimage template Jan 12, 2024
@choldgraf
Copy link
Member

choldgraf commented Jan 12, 2024

Just providing some quick diagnosis since I'm the one that wrote a lot of that infrastructure:

It looks like the failure is related to this template:

https://github.com/2i2c-org/2i2c-org.github.io/blob/main/layouts/partials/ogimage.html

This is the template that defines the "social preview" image for each page. It takes our blank .png and adds text on top of it with the "filter" function. Within that, the function that seems to be breaking is this one:

https://gohugo.io/functions/images/text/

The error seems to be related to the attempt to load a font ( error calling Text: invalid text font source: <nil>). And if you check the URL of the font, it looks like it has changed, so I think that is the issue:

https://github.com/2i2c-org/2i2c-org.github.io/blob/d91f8072ac678742f6c330befd6e9e903f891592/layouts/partials/ogimage.html#L6C1-L6C1

{{ $font_roboto_medium := "https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Medium.ttf" }}

So I think we just need to figure out wherever the .ttf files got moved to, or get a more reliable source of the .ttf file for Roboto-Medium

Here's the PR where they moved it:

@choldgraf choldgraf changed the title Can not build website locally due to failing ogimage template Can not build website locally due to missing font source in ogimage template Jan 12, 2024
@damianavila damianavila moved this from Needs Shaping / Refinement to Complete in DEPRECATED Engineering and Product Backlog Jan 16, 2024
@damianavila damianavila moved this to Done 🎉 in Sprint Board Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done 🎉
Development

Successfully merging a pull request may close this issue.

2 participants