Index.html reverts to older version when adding a new post

I’m having a tough time solving this issue. As per the title when I add a post following the process outlined in the Jekyll docs, my index file reverts back to a previous version.

Using Visual Studio I can revert back to a previous version of the index.HTML but as a result, I lose the latest post that the index.html references.

Any ideas as to how I can correct this issue?

are you editing something inside the _site folder?

you should not be - that folder gets wiped clean every time jekyll rebuilds so if you edit something in there it won’t work.

What file are you editing? can you describe more what you are doing?

Hi there,

I realised it’s probably easier if I share my github repo and explain the issue.

I’m just using the minima theme and some custom CSS.

The problem is whenever I create a new blog in my _post folder, my index.html reverts back and I have to manually over-ride it otherwise I lose everything e.g. menu links, footers etc.

I have not made any changes to the file structure when I first created the site. So the index.html sit in the _site folder.

When I move the index.html to the root, I end up with 2 files, one at the root and the other in _site folder. Is this correct to have 2 index.html?

Where I want to get to is to create a site that will keep the key elements such as the menu links footers etc, while also reflecting any new blog posts I create.

Hope the above information helps

don’t edit anything in the _site folder - just ignore that folder altogether, that is your site built by jekyll. You feed jekyll the contents of the root of your project and it compiles it and puts it in the _site folder.

So yes, you should have an index file in the root and jekyll will then create a corresponding index.html file in the _site folder.

Make sure in your root you only have one index file - sometimes people end up with an index.md and an index.html and the one will over write the other.

Your repo link does not work.

Many thanks for your suggestions. Sorry, my repo was set to private and I’ve now changed it to public so you should be able to access it.

I think the issue was with the index.md over-writing the index.html at root level. I’ve corrected this.

Still seem to be having a problem with my main.css reverting. Should that be a root level or is something conflicting with it?

I think you need to set your baseurl in the config.yml file - I think you should have it as:

baseurl: /awesome2

right now it is set to empty or “”