Hydejack主题Algorithm分类侧边栏链接404问题求助
解决Hydejack主题分类侧边栏显示与404问题
1. 开启分类页面生成配置
首先确认_config.yml中是否包含以下配置,没有则添加:
collections: featured_categories: output: true permalink: /:collection/:name/
该配置确保_featured_categories目录下的文件会生成可访问的静态页面。
2. 修正_featured_categories/Algorithm.md的前置内容
确保该文件的YAML前置内容格式正确,需指定对应布局和分类字段:
--- layout: list title: Algorithm category: Algorithm ---
其中category值必须与文章中categories的内容完全一致,layout: list是Hydejack用于展示分类文章列表的专用布局。
3. 修正菜单中的URL路径
菜单URL需与分类页面的实际生成路径匹配,根据上述permalink配置,正确路径应为/featured_categories/Algorithm/,更新_config.yml的菜单部分:
menu: - title: Example url: /example/ - title: Documentation url: /docs/ - title: About url: /about/ - title: Algorithm url: /featured_categories/Algorithm/
4. 修复文章前置内容的拼写错误
你文章中的data是拼写错误,应改为date,否则可能导致文章无法正确归类:
--- layout: post title: "This is an example post" categories: Algorithm date: 2023-03-24 12:25:00 +09:00 ---
5. 重新构建站点
执行以下命令清除缓存并重新生成站点,避免旧内容干扰:
bundle exec jekyll clean bundle exec jekyll serve
内容的提问来源于stack exchange,提问作者John Kim
相关产品推荐
相关产品推荐

