我根据文档中的教程创建了一个新的 jekyll 项目。 https://jekyllrb.com/docs/step-by-step/01-setup/
我想覆盖我的项目的主页。我在项目的根目录中创建了一个 index.html 文件,但是当我运行
jekyll build
时出现错误:
Run in verbose mode to see all warnings.
Conflict: The following destination is shared by multiple files.
The written file may end up with unexpected contents.
/home/aga/Work/website-jekyll/_site/index.html
- index.markdown
- /home/aga/Work/website-jekyll/index.html
done in 0.403 seconds.
尽管有此警告,我还是运行了
jekyll serve
并获得了正确的站点。但是,当我更改index.md或index.html中的任何内容并点击安全并刷新页面时,它会返回到默认页面。我需要再次运行 jekyll build
和 jekyll serve
。这是预期的吗?感觉很奇怪。如何避免?
警告消息表明您的 Jekyll 项目中存在两个索引文件:
index.md
和 index.html
,这是不正确的,因为它们可以相互覆盖。尝试删除其中一个并仅使用一个作为主索引文件。
此外,如果您按照 Quickstart Jekyll 教程页面上列出的步骤操作并使用
jekyll new myblog
生成新项目,那么您应该跳过分步教程中的 Setup 步骤(因为您已经有了基本设置)感谢 jekyll new
命令)。