-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
关于最新版与Waline评论冲突问题 #1044
Comments
抱歉,图片无法显示,我也没有 Waline 服务器可以在本地复现这个问题。 Sorry, the images cannot be displayed and I don’t have a Waline server to reproduce this problem locally. |
@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:
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 <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. 我的hugo版本是 0.138.0 ,主题版本为3.29 ,我使用starter 模板并在
这样我可以更改本地文件查看效果。 <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 -}} 这可能充满了错误和不规范的代码,但是现在在我的机器上,我的博客可以在开启数学公式渲染的情况下显示评论了。 |
This should be easy to fix. Just modify {{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}}
<script>
window.addEventListener("DOMContentLoaded", () => {
renderMathInElement(document.body, {
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
{ left: "\\(", right: "\\)", display: false },
{ left: "\\[", right: "\\]", display: true }
],
ignoredClasses: ["gist", "waline-container"]
});})
</script> |
@ethan-enhe It works.I think that‘s because Katex renders before the waline compoments mounted,then |
fixed in #1103 |
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
The text was updated successfully, but these errors were encountered: