kinggozhang / hexo-theme-ace

A Hexo Theme:ACE
Apache License 2.0
48 stars 7 forks source link

请问如何生成tags和categories? #6

Open araisann opened 4 years ago

araisann commented 4 years ago

文章都带有tags和categories。
使用默认的landscape主题,tags和categories点进去都能正常展示。

换成hexo-theme-ace后,侧栏点击某个tag,显示404。
点击某个categories,则显示全部页面。

网上都是说 hexo new page tags

然后编辑创建的souce/tags/index.md

---
title: tags  
date: 2016-11-11 21:40:58  
type: "tags"  
---

但结果点击某个tag,展示的是空白页面。 categories用这种方式情况未变。

是要自己怎么配置tags和categories吗?

araisann commented 4 years ago

哦。已解决。
把souce/tags/index.md中的内容改成:

---
title: tags
date: 2019-10-23 09:41:27
type: tags
layout: "tags"
---

tags就正常了。

araisann commented 4 years ago

tags是可以了。但categories还是不行。
无论点击哪个categorie,显示的都是所有页面的列表。

kinggozhang commented 4 years ago

try to add this:

category: yourcat

cheng521521 commented 4 years ago

请问你的分类是怎么出来的啊 `--- title: 文章分类 date: 2019-12-27 15:15:35 type: categories layout: "categories"

` 这样出不来

kinggozhang commented 4 years ago

再加一句: category: yourcat

cheng521521 commented 4 years ago

弄好了,非常感谢,谢谢您的回答!

sandrewzq commented 4 years ago

@kinggozhang 请问下categories的问题能具体说下怎么加吗?我这里加上了还是不行。 我看了下生成后的public目录下的public\categories\test\index.html文件,感觉像是按照archive.ejs生成的。 我的配置如下

---
title: categories
date: 2020-01-17 11:30:08
type: categories
layout: "categories"
category: categories
---
kinggozhang commented 4 years ago

你的category叫什么名字? categories?

xiao-gy commented 4 years ago

想问问category: yourcat应该怎么加,yourcat代表什么,谢谢

xiao-gy commented 4 years ago

@kinggozhang 能让我参考一下您博客的tags和categories文件的配置吗

kinggozhang commented 4 years ago

举例,现在我要生成一个hexo 的category 1,

hexo new page hexo

这时候会生成source/hexo/index.md 编辑这个文件,在文件头添加:

category: hexo
  1. 新建博文
    hexo new blog1

    这时候生成source/_posts/blog1.md 编辑这个文件,文件头添加:(或者使用hexo-admin)

    categories:
    - hexo

    就可以了。。

xiao-gy commented 4 years ago

哦哦,谢谢帮助

在 2020年4月5日,下午3:53,kinggozhang notifications@github.com 写道:

举例,现在我要生成一个hexo 的category 1, hexo new page hexo 这时候会生成source/hexo/index.md 编辑这个文件,在文件头添加: category: hexo

  1. 新建博文 hexo new blog1 这时候生成source/_posts/blog1.md 编辑这个文件,文件头添加:(或者使用hexo-admin) categories:

hexo 就可以了。。

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kinggozhang/hexo-theme-ace/issues/6#issuecomment-609375136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4JGH5EJMZ6JBKV5HF7ILTRLA2HTANCNFSM4JD2T2VQ.

sandrewzq commented 4 years ago

你的category叫什么名字? categories?

您好,我的问题是发现category是按照archive.ejs生成的,但是我使用官方的landscape主题没有问题,我把ace和landscape对比了下,发现hexo-theme-ace/layout/categories.ejs文件的命名不同,然后我把文件名修改成category.ejs就可以了,您可以测试验证一下。

kinggozhang commented 4 years ago

对的,hexo有个适配优先级,优先用categories.ejs。 谢谢告知