Blog html is generated into several nested directories

#1

I am new to Jekyll and am currently following along with the step by step tutorial to get acquainted with the stack.

My issue is that my blog html files which are generated to the _site directory end up in nested folders. The folders correspond with the date format required for the blog post markdown files.

Here is a visual of the file structure as it is now (only including relevant directories and files):

root/
|____ _posts/
|           2019-04-16-post-01.md
|           2019-04-16-post-02.md
|____ _site/
|__________2019/
|______________04/
|________________16/
|                  post-01.html
|                  post-02.html
|__________ assets/
|                 css/
|                    styles.css
|
|__________ blog.html
|__________ index.html
|             

This means that the css file path which all html is using is incorrect for the blog posts. The path would have to be ../../../assets/css/styles.css

Can anyone shed some light on why Jekyll generates the blog files nested like this and what the resolution may be?

#2

you can change it by changing the permalink if you want, that is just a common way to do it.

You can give the path to your css as: /assets/css/styles.css and it will work anywhere and everywhere as the leading / says to start at the root.

#3

Ah, that makes sense. I was just poking around the documentation for those. Thank you for the tip!

#4

Though, do take note that /assets/css/styles.css is valid only when there’s an active server (via remote hosting or locally through command jekyll serve).

#5

Got it, thank you for adding to the conversation!