Jekyll 默认页面
Jekyll default page
如何更改默认起始页?目前,index.html 始终是帖子的索引。
我喜欢在 index.html 上显示我当前 /about 页面的内容,并希望将 /articles link 改为帖子索引。
复制粘贴/about/index.html的内容到/index.html是唯一的解决办法吗?
这不是真正的 Jekyll 问题,它更像是一个信息架构问题。
您的页面层次结构是这样的:
|-index.html
|-articles.html
|-...
如果你想写成markdown,就在index.html
或index.md
中添加你想要的内容。
创建一个 article.html
或 md
页面,然后将 index.html 的实际内容复制到其中。
最后,如果您想在 /articles/
访问您的文章页面,只需在前面添加 permalink: articles/
。否则,默认情况下将在 articles.html
.
到达
您可以在 jekyll
中使用 gem 'jekyll-redirect-from' 来设置与 index.html 不同的主页,还可以自定义任何 xxxx.html.[=23= 的输出 URL ]
将此行添加到您项目的 Gemfile
:
gem 'jekyll-redirect-from'
然后在终端执行:
bundle
安装到您的环境后,将其添加到您的 _config.yml
:
plugins:
- jekyll-redirect-from
现在,要将 about.html
设置为主页:
在 about.html
:
开头添加
---
permalink: /
redirect_from:
- /about
---
因此,www.website.com/about
将重定向到 www.website.com
并显示 about.html
的内容。
如何更改默认起始页?目前,index.html 始终是帖子的索引。
我喜欢在 index.html 上显示我当前 /about 页面的内容,并希望将 /articles link 改为帖子索引。
复制粘贴/about/index.html的内容到/index.html是唯一的解决办法吗?
这不是真正的 Jekyll 问题,它更像是一个信息架构问题。
您的页面层次结构是这样的:
|-index.html
|-articles.html
|-...
如果你想写成markdown,就在index.html
或index.md
中添加你想要的内容。
创建一个 article.html
或 md
页面,然后将 index.html 的实际内容复制到其中。
最后,如果您想在 /articles/
访问您的文章页面,只需在前面添加 permalink: articles/
。否则,默认情况下将在 articles.html
.
您可以在 jekyll
中使用 gem 'jekyll-redirect-from' 来设置与 index.html 不同的主页,还可以自定义任何 xxxx.html.[=23= 的输出 URL ]
将此行添加到您项目的 Gemfile
:
gem 'jekyll-redirect-from'
然后在终端执行:
bundle
安装到您的环境后,将其添加到您的 _config.yml
:
plugins:
- jekyll-redirect-from
现在,要将 about.html
设置为主页:
在 about.html
:
---
permalink: /
redirect_from:
- /about
---
因此,www.website.com/about
将重定向到 www.website.com
并显示 about.html
的内容。