Open hengxin007 opened 3 months ago
抱歉,图片无法显示,我也没有 Waline 服务器可以在本地复现这个问题。
Sorry, the images cannot be displayed and I don’t have a Waline server to reproduce this problem locally.
我这也出现这个问题,会显示评论数,不显示评论内容。 如果参数 article: math: false 改后就可以显示 ![Uploading 微信图片_20241006221547.png…]()
@yisusen 抱歉,你的图片也显示不出来,似乎没有成功上传。
纠正一下,是 params.article.math
为 true
时,评论显示不出来,为 false
就可以正常显示,各位博主可以用这个先缓解一下。
@yisusen 抱歉,你的图片也显示不出来,似乎没有成功上传。
I have exactly the same problem, my hugo version is v0.134.3 theme version v3.26.
My Hugo version is 0.138.0, and the theme version is 3.29. I used the starter template and cloned the theme repository into the ./theme folder. I then modified the go.mod file as follows:
module github.com/CaiJimmy/hugo-theme-stack-starter
go 1.17
require github.com/CaiJimmy/hugo-theme-stack/v3 v3.29.0 // indirect
replace github.com/CaiJimmy/hugo-theme-stack/v3 => ./theme/hugo-theme-stack
This allows me to modify local files and see the changes. Since I have no experience in web development, I used ChatGPT to make modifications. After about two hours of asking questions, I achieved the following result: modifying the waline.html
file from
<script>
/// Waline client configuration see: https://waline.js.org/en/reference/client.html
Waline.init({{ $config | jsonify | safeJS }});
</script>
{{- end -}}
to
<script>
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
const walineContainer = document.querySelector('#waline');
if (walineContainer) {
Waline.init({{ $config | jsonify | safeJS }});
} else {
console.error("Waline container not found. Make sure the element with ID 'waline' exists.");
}
}, 500); // Delay 500ms to load waline comments.
});
</script>
{{- end -}}
This may be full of errors and non-standard code, but now my blog can display comments with math formula rendering enabled on my machine. Hope this helps you!
我的hugo版本是 0.138.0 ,主题版本为3.29 ,我使用starter 模板并在./theme
文件夹下clone了主题仓库,并把go.mod文件更改为
module github.com/CaiJimmy/hugo-theme-stack-starter
go 1.17
require github.com/CaiJimmy/hugo-theme-stack/v3 v3.29.0 // indirect
replace github.com/CaiJimmy/hugo-theme-stack/v3 => ./theme/hugo-theme-stack
这样我可以更改本地文件查看效果。
因为我对web开发完全没有经验,所以使用了chatgpt,在经过约两小时的提问后获得如下结果:修改 waline.html
文件。
从
<script>
/// Waline client configuration see: https://waline.js.org/en/reference/client.html
Waline.init({{ $config | jsonify | safeJS }});
</script>
{{- end -}}
修改为
<script>
document.addEventListener("DOMContentLoaded", function() {
setTimeout(() => {
const walineContainer = document.querySelector('#waline');
if (walineContainer) {
Waline.init({{ $config | jsonify | safeJS }});
} else {
console.error("Waline container not found. Make sure the element with ID 'waline' exists.");
}
}, 500); // 延迟 500 毫秒加载 Waline 评论区
});
</script>
{{- end -}}
这可能充满了错误和不规范的代码,但是现在在我的机器上,我的博客可以在开启数学公式渲染的情况下显示评论了。
希望对你有帮助!
What happened?
Waline 评论报错
版本与配置
版本:
配置:
hugo.yaml
Bug 复现
当
hugo.yaml
配置文件中的:params.article.math
为true
时,Waline
的评论就会显示不出来,一直转圈并且报错:如果将
params.article.math
改为true
则正常显示,无报错。Hugo version
hugo v0.131.0-bfbee17932ff24009008aa94cdd75c0c41f59279+extended windows/amd64 BuildDate=2024-08-02T09:03:48Z VendorInfo=gohugoio
Theme version
v3.26.0
What browsers are you seeing the problem on?
Chrome
More information about the browser
Windows10,Chrome v127.0.6533.89
Relevant log output
No response
Link to Minimal Reproducible Example
https://github.com/hengxin007