liwenyip / hugo-easy-gallery

Automagical css image gallery in Hugo using shortcodes, with optional lightbox/carousel gadget using PhotoSwipe and jQuery.
MIT License
573 stars 111 forks source link

load-photoswipe.js and hugo-easy-gallery.css not loaded when BaseURL contains path #44

Closed Anthop-2 closed 2 years ago

Anthop-2 commented 5 years ago

load-photoswipe.js and hugo-easy-gallery.css are not imported correctly when the site is configured with a path, for example: https://www.example.com/mysite/

This appears to be due to the fact that the paths are hard coded relative paths in figure.html, gallery.html, and load-photoswipe.html.

For example, in figure.html, changing:

<link rel="stylesheet" href="/css/hugo-easy-gallery.css" />

to:

<link rel="stylesheet" href="{{ .Site.BaseURL }}/css/hugo-easy-gallery.css" />

should address the issue.

liwenyip commented 5 years ago

Hi @Anthop-2

Thanks for raising this.

Can you please test for me if the following works:

<link rel="stylesheet" href="{{ "css/hugo-easy-gallery.css" | relURL }} />

If that works it would be a more elegant solution.

Mengesh commented 5 years ago

It works. Thank you.

Mengesh commented 5 years ago

Actually .js should be also loaded with relURL. I created a pull request #47