Documentation to make it easier to debug linking to images, resources, CSS, and JS within a static site that's generated via Jekyll.
- When calling CSS and JS from the
./_includes
and./_layouts
directories - When linking to images and resources from HTML/Markdown pages
In this scenario, all CSS and JS scripts are located in ./assets/css
or ./assets/js
respectively.
Use /assets
directly, which will append onto the URL. Example:
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
Use Liquid/Jekyll logic to determine the assets URL. Example:
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/bootstrap.min.css">
In these examples, all images and resources are located in ./assets/images
or ./assets/resources
respectively.
Use /assets
directly, which will append onto the base URL. Example:
<img class="image" src="/assets/images/image.png">
Use Liquid/Jekyll logic to determine the assets URL in case the page you're rendering this logic on changes. Example:
<img class="image" src="{{ site.baseurl }}/assets/images/image.png"\>
If the site is password protected (as shown in scottishstoater/protected-github-pages or matteobrusa/Password-protection-for-static-pages), and the images/resources are placed in the ./HASH
directory to keep them private. Then you can either link directly to the asset or hard-code the HASH
into the Liquid/Jekyll logic.
Example to link directly to the asset:
<img class="image" src="../images/image.png"\>
Example to hard-code the HASH
into the Liquid/Jekyll logic:
<img class="image" src="{{ site.baseurl }}/HASH/images/image.png"\>
Thanks for the help. I already resolved the problem and now working on other parts. It seems that the spaces between the letters or the name of the screenshot itsell was the issue. If you want to look through my code, you can visit it here: https://github.com/Antboi123/fvwjervesamvjksfcneajl9823v9yh67y5edfy6u7iyuj9oyg543d23456765g4f3dde4fr5gt6hy7ju87hygtfderftgyhu7ji8