hexo-theme-yilia
hexo-theme-yilia copied to clipboard
hexo g的时候出现错误!
TypeError: /home/wwwroot/hexo.imydl.tech/themes/yilia/layout/page.ejs:1
>> 1| <%- partial('_partial/article', {post: page, index: false}) %>
/home/wwwroot/hexo.imydl.tech/themes/yilia/layout/_partial/article.ejs:61
59| </div>
60| <% } %>
>> 61| <%- partial('post/tag') %>
62| <%- partial('post/category') %>
63| <% if (index && theme.show_all_link){ %>
64| <p class="article-more-link">
/home/wwwroot/hexo.imydl.tech/themes/yilia/layout/_partial/post/tag.ejs:7
5| <% post.tags.forEach(function(tag, i){ %>
6| <li class="article-tag-list-item">
>> 7| <a href="javascript:void(0)" class="js-tag article-tag-list-link color<%= tag.name.length % 5 + 1 %>"><%-tag.name%></a>
8| </li>
9| <% }) %>
10| </ul>
Cannot read property 'length' of undefined
遇到了同样的问题,请问答主解决了嘛QAQ?跪求解决方案!
Update: 已解决.
将./themes/yilia/layout/_partial/post/category.ejs
改为:
<% if (post.categories && post.categories.length){ %>
<div class="article-category tagcloud">
<i class="icon-book icon"></i>
<ul class="article-tag-list">
<% post.categories.forEach(function(tag, i){ %>
<% if (tag.hasOwnProperty('name')){ %>
<li class="article-tag-list-item">
<a href="<%= config.root %><%= tag.path %>/" class="article-tag-list-link color<%= tag.name.length % 5 + 1 %>">
<%-tag.name%></a>
</li>
<% } %>
<% }) %>
</ul>
</div>
<% } %>
将./themes/yilia/layout/_partial/post/tag.ejs
改为:
<% if (post.tags && post.tags.length){ %>
<div class="article-tag tagcloud">
<i class="icon-price-tags icon"></i>
<ul class="article-tag-list">
<% post.tags.forEach(function(tag, i){ %>
<% if (tag.hasOwnProperty('name')){ %>
<li class="article-tag-list-item">
<a href="javascript:void(0)" class="js-tag article-tag-list-link color<%= tag.name.length % 5 + 1 %>">
<%-tag.name%></a>
</li>
<% } %>
<% }) %>
</ul>
</div>
<% } %>
Update at Nov 13, 2021: 感谢 @white-loub 指出错误,已修复qwq
已解决.
好像还是不行哦
@namasikanam 的解决方案的第二个文件修改的地方少了一个 if