daviddarnes / alembic

⚗️ A Jekyll boilerplate theme designed to be a starting point for any Jekyll website
https://alembic.darn.es
MIT License
767 stars 903 forks source link

[Question]: add lightbox2 #187

Closed emanuelegdepaoli closed 1 year ago

emanuelegdepaoli commented 1 year ago

I'am trying to add lighbox2 to my website created using alembic as theme. I followed the instructions in this page:

1- added the folders css and js with the required files. 2- added the folder _layout which includes a custom default.html, with the required modifications.

However, when running the site locally, I get the following errors:

[2023-01-06 10:56:37] ERROR `/page/css/lightbox.css' not found. 
[2023-01-06 10:56:37] ERROR `/page/js/lightbox-plus-jquery.js' not found.

where page is the website section where I try to load the images. That is, I have a page.md file in my main folder and my header in _config.yml is like the following:

# Header nav
navigation_header:
- title: Home
  url: /
- title: Mypage
  url: /page/

This is my first attempt to build a website and I really don't know how to solve the path problem.

daviddarnes commented 1 year ago

I think you need to place the CSS and JS files in the assets directory and make sure when you reference them you're pointing to them absolutely. From looking at the errors you posted you've either added /page/ into the path, which isn't needed, or they are being set relatively which isn't right either. They need to be absolute so the files can be found from any page on the site. Hope this makes sense!

emanuelegdepaoli commented 1 year ago

Thank you for your help, the problem was that the CSS file, the JS file and the folder image have to be all in assets and I have to point to them absolutely.