Hello!
I am new to Jekyll, but I have successfully managed to make my own website, which runs fine locally. I uploaded it to Github Pages, and noticed none of the links worked. I figured out I need to use {{ ... | relative_url }}
, so I’m trying to implement it. It works in the navigation menu etc., but I encounter a problem in my image gallery. I loop through the pages in my project and list them in a gallery with a link to the page and an image. The code below is inside a for-loop, and gathers the image that is shown in the gallery.
<img class="prosjekt-galleri-figur-bilete" src={{ '/assets/images/{{ prosjekt.name | replace: '.md', '' }}/WEBP/COVER.webp' | relative_url }} srcset="" alt="{{ prosjekt.TITTEL }}" loading="lazy">
This src does not work. Why does it not? In the source code inspector the code becomes:
src="/assets/images//WEBP/COVER.webp"
Why is not my {{prosjekt.name}} included?
This is what I had before, and it worked locally but not in Github Pages.
src='/assets/images/{{ prosjekt.name | replace: '.md', '' }}/WEBP/COVER.webp'
Does anyone have any ideas to how I can fix this? Should I remove the replace and go for another approach, so I don’t get two variables within the same string? Any help would be very appreciated!
Have a nice day!