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

building failure about mastodon.html #904

Open
zwyyy456 opened this issue Apr 15, 2024 · 11 comments
Open

building failure about mastodon.html #904

zwyyy456 opened this issue Apr 15, 2024 · 11 comments

Comments

@zwyyy456
Copy link

Describe the problem:

Today, I update the hugo-coder theme and then run hugo serve, then I meet building failure.

My last hugo-coder theme is c340320a, it works well, and there is nomastodon.html in that version.

the log is as follows:

❯ hugo serve        
Watching for changes in /Users/zwyyy/code/blog/coder_blogs/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /Users/zwyyy/code/blog/coder_blogs/config.toml, /Users/zwyyy/code/blog/coder_blogs/themes/coder/config.toml
Start building sites … 
hugo v0.124.1-db083b05f16c945fec04f745f0ca8640560cf1ec+extended darwin/arm64 BuildDate=2024-03-20T11:40:10Z VendorInfo=brew

ERROR render of "page" failed: "/Users/zwyyy/code/blog/coder_blogs/themes/coder/layouts/posts/single.html:48:11": execute of template failed: template: posts/single.html:48:11: executing "content" at <partial "posts/mastodon.html" .>: error calling partial: "/Users/zwyyy/code/blog/coder_blogs/themes/coder/layouts/partials/posts/mastodon.html:4:91": execute of template failed: template: partials/posts/mastodon.html:4:91: executing "partials/posts/mastodon.html" at <.host>: can't evaluate field host in type bool
Built in 504 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/Users/zwyyy/code/blog/coder_blogs/themes/coder/layouts/posts/single.html:48:11": execute of template failed: template: posts/single.html:48:11: executing "content" at <partial "posts/mastodon.html" .>: error calling partial: "/Users/zwyyy/code/blog/coder_blogs/themes/coder/layouts/partials/posts/mastodon.html:4:91": execute of template failed: template: partials/posts/mastodon.html:4:91: executing "partials/posts/mastodon.html" at <.host>: can't evaluate field host in type bool
@zwyyy456
Copy link
Author

it seems that commits 60fdc75 cause the building failure.

@halon176
Copy link

same issue, hugo v0.128.0+extended linux/amd64

@halon176
Copy link

update: in my case, same errore

Error: error building site: render: failed to render pages: render of "page" failed: "/home/halon/code/quickstart/themes/hugo-coder/layouts/posts/single.html:48:11": execute of template failed: template: posts/single.html:48:11: executing "content" at <partial "posts/mastodon.html" .>: error calling partial: "/home/halon/code/quickstart/themes/hugo-coder/layouts/partials/posts/mastodon.html:4:91": execute of template failed: template: partials/posts/mastodon.html:4:91: executing "partials/posts/mastodon.html" at <.host>: can't evaluate field host in type bool

It comes from the presence of the comments: true key in the header of some posts. Removing this key eliminates the error.

@zwyyy456
Copy link
Author

zwyyy456 commented Sep 6, 2024

update: in my case, same errore

Error: error building site: render: failed to render pages: render of "page" failed: "/home/halon/code/quickstart/themes/hugo-coder/layouts/posts/single.html:48:11": execute of template failed: template: posts/single.html:48:11: executing "content" at <partial "posts/mastodon.html" .>: error calling partial: "/home/halon/code/quickstart/themes/hugo-coder/layouts/partials/posts/mastodon.html:4:91": execute of template failed: template: partials/posts/mastodon.html:4:91: executing "partials/posts/mastodon.html" at <.host>: can't evaluate field host in type bool

It comes from the presence of the comments: true key in the header of some posts. Removing this key eliminates the error.

The better solution is to edit the single.html,remove the reference of mastodon.html

@luizdepra
Copy link
Owner

Hmm. So, it seems there is a wrong path somewhere. I'm going to take a look this weekend. Ty.

@luizdepra
Copy link
Owner

It looks like there is a misconfiguration on your site. Do you want to use mastodon comments? Could you share your configuration file?

@zwyyy456
Copy link
Author

sorry to be late, my config file is under config/_default,as follow:
图片

the content of params.toml is as follow:

license = '<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA-4.0</a>'
avatarURL = "images/Quirrel.jpg"                                                                    # 头像
math = true
katex = true
env = "production"


dateFormat = "January 2, 2006"
since = 2022
# Git Commit in Footer, uncomment the line below to enable it
commit = "https://github.com/luizdepra/hugo-coder/tree/"
# Right To Left, shift content direction for languagues such as Arabic
rtl = false # 阿拉伯语为 true

# Specify light/dark colorscheme
# Supported values:
# "auto" (use preference set by browser)
# "dark" (dark background, light foreground)
# "light" (light background, dark foreground) (default)
colorScheme = "auto"

# Hide the toggle button, along with the associated vertical divider
hideColorSchemeToggle = false
# Series see also post count
maxSeeAlsoItems = 5

enableNestedSections = true # 启用嵌套子目录支持

# Custom CSS
customCSS = ["scss/css/search.css", "scss/css/toc.css"]
# Custom SCSS, file path is relative to Hugo's asset folder (default: {your project root}/assets)
customSCSS = []
# Custom JS
customJS = ["js/search.js", "js/fuse.min.js", "js/toc.js"]

UseHugoToc = true

[[social]]
name = "Github"
icon = "fa fa-2x fa-github"
weight = 1
url = "https://github.com/zwyyy456/"

[[social]]
name = "Twitter"
icon = "fa fa-2x fa-twitter"
weight = 3
url = "https://twitter.com/zwyyy456/"

[[social]]
name = "LinkedIn"
icon = "fa fa-2x fa-linkedin"
weight = 4
url = "https://www.linkedin.com/in/%E7%82%9C%E7%BF%BC-%E6%9B%BE-b65b80234/"

[[social]]
name = "RSS"
icon = "fa fa-2x fa-rss"
weight = 6
url = "https://myhugosite.com/index.xml"
rel = "alternate"
type = "application/rss+xml"

# 评论系统
[utterances]
repo = "zwyyy456/blog-comment"
issueTerm = "pathname"
theme = "preferred-color-scheme"
label = "comment"

@zwyyy456
Copy link
Author

There is no Mastodon-related configuration item in my configuration file.

@luizdepra
Copy link
Owner

Ow, I see the problem now.
The mastodon template is using params.comments to add the template. See here.

We just need to rename it.

@luizdepra
Copy link
Owner

Also, you should use disableComments option to disable comments in a post. The default is 'enabled'.

@luizdepra
Copy link
Owner

I think it is fixed now.

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

3 participants