_layouts, _sass and _includes got cleaned up on build

I want to add Latex to my site, so I have to add a line to include MathJax in ./_layout/some_html.html. However, I just cannot find _layouts, _sass and _includes. I added it manually, they just got deleted when I run either jekyll serve or bundle exec jekyll serve. Even those folders in my gem-theme folders were cleaned up as well. I am new to Ruby and Jekyll, so any suggestions will be helpful!
Thanks in advance.

Also, I followed the instructions in https://jekyllrb.com/docs/themes/ to change to another theme, but it just displays nothing because the _layouts folders were cleaned on built and I think that is the same issue here.

Ok. Problem solved. I think I put them in the wrong place. I placed them in _site folder, so this folder just rebuild every time on build and that’s why. But still I cannot render anything when I am using a gem based theme.

Can you elaborate on the steps taken to render, please?
(If you have the project made public posting the url to the repository would be added help.)

1 Like

problem solved. The problem was, when I changed the theme, the corresponding _folders were not added to my root folder automatically. Then the site just cannot find the layout page they are looking for, and finally a blank page was rendered. So I have to manually copied and pasted the from gems folder.
I just wonder if that is normal with Jekyll when switching themes, because this link’s description doesn’t sound like I have to manually copy those folders…

You’re right in wondering if its normal to have to copy “_folders” when switching themes.
The deal behind using gem-based themes is that unless you need to customize a theme file, you shouldn’t have to copy anything to your project’s source directory. Doing so will render you unable to easily sync future updates to your theme.


TL;DR:
A well maintained them would have proper documentation set up to easily migrate from the default theme Minma.


The one common issue users face while switching themes is that the layouts are named arbitrarily. So, instead of having a _layouts/post.html for posts, the theme may have _layouts/entry.html intended for blog entries and hence users will have to edit each and every markdown document in the _posts directory to switch to layout: entry from layout: post.

At times its possible that a theme’s _includes/head.html references a css/style.css as the main stylesheet instead of the default assets/main.css and this could lead to an unstyled site all of a sudden.

A