GjjvdBurg/HugoPhotoSwipe

Photoswipe not defined

Closed this issue · 1 comments

Hi again,

Moving forward in integrating hps in my theme, I stumbled upon an error in the javascript file:

Uncaught ReferenceError: PhotoSwipe is not defined
    at openPhotoSwipe (pswp_gallery.js:197)
    at initPhotoSwipeFromDOM (pswp_gallery.js:273)
    at pswp_gallery.js:278

I can see that PhotoSwipe is not defined in pswp_gallery.js. I followed the rest of the wiki to the letter.

Any ideas?

catkfr

This happens because your photoswipe.min.js file can't be found. As is shown in the wiki, the gallery template uses the following line for this file:

<script type="application/javascript" src="{{ .Site.BaseURL }}js/photoswipe.min.js"></script>

This means the photoswipe.min.js file should be in a folder js in the static directory of Hugo. You can change the location of the file to suit your settings. Also see Adding static files in the wiki.