Jekyll Wiping My Directory

自闭症网瘾萝莉.ら 提交于 2020-01-03 04:48:10

问题


I followed the instructions for Jekyll Quickstart. Whenever I make changes in my site's directory, the changes get wiped somehow. For example, I modified some of the code in index.html, only to have it return to Jekyll's default. I also created a subdirectory in _site called 'otherservices' with an index.html. That gets wiped as well. Any idea why this may be happening? I can't really use Jekyll if it keeps wiping.


回答1:


Jekyll is a static website generator, each time it generates a website it place files in the _site folder.

Any changes you make inside the above folder are lost because it is recreated when executing jekyll build or jekyll serve .

Changes should be made to the rest of the files or folders so they will be processed and locate the resulting files inside _site.




回答2:


You should not write manually into _site directory, that is Jekyll's output.

If you need an otherservices directory in the output, place it one level above, like this:

_site/
otherservices/
    index.html
index.md

Jekyll will copy every file and directory into _site, which is not excluded in the configuration and doesn't start with _ prefix. Files that have front-matter will be processed in addition to copying. So in result Jekyll will generate this structure:

_site/
    otherservices/ (copies it)
        index.html
    index.html     (generates it from index.md)
otherservices/
    index.html
index.md

It is worth reading the documentation on how to create custom pages.



来源:https://stackoverflow.com/questions/45660789/jekyll-wiping-my-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!