Skip to content
This repository was archived by the owner on Jul 29, 2021. It is now read-only.
This repository was archived by the owner on Jul 29, 2021. It is now read-only.

Categories页面不能正常显示 #36

@JiuMingZhu

Description

@JiuMingZhu

对照着tag页面的layout依葫芦画瓢把
"xxx\themes\hexo-theme-nayo\layout\category.ejs"
改为如下代码

<section>

  <% if( is_category()){ %>

  	<span class="page-title"><%=  "# "+ page.category %></span>

  	 <% page.posts.each(function (post) { %>  

        <%- partial('_partial/_common/item',{post:post}) %>       

  	 <% }) %> 	
  <%}else {%>    
      
        <span class="page-title"><%=  __('Page.Categories') %></span> 
        
        <% site.categories.sort('date',-1).each( function (category){%>
            
            <a class="category-wrap slideDownMin " href="<%- url_for(category.path) %>">    
            <span class="iconfont icon-category-inner"></span>           
               <span class="category-name"> <%- category.name %> </span>
               <span class="category-count"><%- category.length %></span>  
             </a>
        <% })%>

    <%}%>	    
</section>

启用categories
hexo new page categories
然后找到对应的index.md
编辑如下

---
title: categories
date: 2018-06-30 19:10:40
type: "categories"
layout: "category"
---

因为作者在他的模板里面是cateory,所以这边的layout不要写错
参照:#13

主题的配置文件中不要忘记改了

menu:
  home: /
  archives: archives
  categories: categories
  tags: tags
  about: about
  search: search

更改完之后category可以正常显示啦
图例
应该是我依葫芦画瓢样式没选择对,不过总算是能正常显示界面了:P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions