spring
spring copied to clipboard
Template Error
页面显示Template Error。
报错如下:
main.min.js:2 Template Error
<id>
anonymous
<name>
Render Error
<message>
Cannot read property 'length' of undefined
<line>
1
<source>
<%$.each(blogs, function(i, blog) {%> <article> <span class="date"><%=$.spring.fn.getDate(blog.created_at)%></span> <h3><a href="<%=blog.html_url%>" data-href="#issues/<%=encodeURIComponent(blog.number)%>" class="taplink"><%=blog.title%></a></h3> <%if(blog.labels.length) {%> <p class="tag"> <%$.each(blog.labels, function(j, label) {%> <a href="https://github.com/<%=$.spring.config.owner%>/<%=$.spring.config.repo%>/issues?labels=<%=encodeURIComponent(label.name)%>&page=1&state=open" class="taplink" style="background: #<%=label.color%>" data-href="#labels/<%=encodeURIComponent(label.name)%>"><%=label.name%></a> <%})%> </p> <%}%> </article> <%})%>
你是不是用的码云 gitee ??? 我第一次用码云部署也是提示模板错误。 改成github fork之后 我已经部署成功了 https://geekyouth.github.io/blog/ 💯
Hi! 👋 I've opened PR #22 to address this template error. The crash occurs because blog.labels can be undefined for some issues, causing the template to fail when checking .length. This PR adds a safe null-check to gracefully handle missing labels, fixing the rendering issue. Feel free to review it, and let me know if you have any questions! 🙌