简体   繁体   中英

Jekyll assets get deleted

I'm using jekyll to build a simple static website. My _config file is basically the default. I have an issue with including images in my website.

I have an images directory inside my _site/assets directory (which I simply copy pasted into). Upon running the website with bundle (locally), the images folder gets deleted from the directory. If I copy it back there then the images are properly shown on the site, but upon refresh they are deleted again.

As I understand it, I need to build the folder using bundle so it doesn't delete it, but the exact way this is done is unclear to me. Can someone please explain what is happening and how I could fix it?

I have an images directory inside my _site/assets directory (which I simply copy pasted into). Upon running the website with bundle (locally), the images folder gets deleted from the directory.

The _site folder is deleted and rebuilt after every change or jekyll build execution. You should put your files in the /images/ directory in the main project folder.

As I understand it, I need to build the folder using bundle so it doesn't delete it, but the exact way this is done is unclear to me. Can someone please explain what is happening and how I could fix it?

In Terminal, navigate to the root directory of the specific jekyll folder (eg /theme-name/) and use the command jekyll build to rebuild the _site folder reflecting any changes you've made.

_site folder gets regenerated in each build, it is where jekyll outputs the final site.

You should place the images folder at the root directory, so it will be copied by Jekyll to _site/images .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM