问题
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