基本搭建好后發現,分類或標簽點進去網頁不存在,但是具體的一個分類能夠進去。
原來是沒有設置好,解決起來也很簡單。
一、 新建 標簽 和分類 頁面
在根目錄輸入命令 hexo new page categories 會自動新建 categorier 文件夾並生成一個index.md文件,將里面的代碼改為:
--- title: categories date: 2020-01-21 12:12:26 type: "categories" ---
同理,「標簽」也一樣 hexo new page tags 生成 tags 文件夾,其中會自動生成一個index.md文件,將代碼改為:
--- title: tags date: 2020-01-21 12:13:08 type: "tags" ---
二、配置菜單
在主題文件下的_config.yml中
menu: home: / || home #about: /about/ || user tags: /tags/ || tags categories: /categories/ || th archives: /archives/ || archive #schedule: /schedule/ || calendar #sitemap: /sitemap.xml || sitemap #commonweal: /404/ || heartbeat # Enable / Disable menu icons / item badges. menu_settings: icons: true
三、使用時
如果要對文章使用「tags」「categories」,只需在文章開頭添加如下代碼:
--- title: 摸魚 date: 2020-01-21 12:04:59 tags: 雜項 categories: 技術 ---
為了方便,我們可以修改post模板,修改Hexo\scaffolds\post.md
--- title: {{ title }} date: {{ date }} tags: categories: ---
參考鏈接:
1. https://www.jianshu.com/p/f138032e7539
2. https://blog.csdn.net/mqdxiaoxiao/article/details/93644533
