• Resolved Obje

    (@harrow)


    Hi Arno,

    First of all thank you for your awesome plugin. I was previously using the native Photoswipe with ACF plugin on my website in order to create a tailor-made gallery but I discovered your plugin and you made my life easier !

    I was wondering if you have an idea to customize the urls generated by Photoswipe when triggering the plugin with the data of the current picture like so :

    https://www.website/page/theansweris42
    instead of
    https://www.website/page/#&gid=1&pid=12

    It’s not directly related to you plugin but as you may have went deep into Dimitry Semenov work, maybe you have an idea?

    Thanks again,
    J

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Arno Welzel

    (@awelzel)

    It’s not possible to change the URLs without braking the correct function of PhotoSwipe. The URL is used for a single image. You can use that URL to open the image using the lightbox, nothing else. Just replacing the URL in the URL bar with something else which does not represent the currently displayed image but opens a completely different page makes no sense at all.

    The URLs are generated inside PhotoSwipe when an image is displayed in the lightbox. gid and pid are the ID of the image group and the image itself which is currently displayed. The frontend script also parses the URL to get the parameters from gid and pid so it can tell PhotoSwipe to open the lightbox using this specific image.

    It may be possible to use “/page/theansweris42” instead of “/page/#&gid=1&pid=12” in the URL when opening an image (as long as the browser supports history.pushState() or history.replaceState() and this is not blocked for security reasons), this could be achieved by modifying PhotoSwipe to accept an URL parameter for each image in the collection to be used.

    However – the real problem starts when someone wants to open such an URL. What should happen, if someone opens “/page/theansweris42″? In this case the URL /”page/theansweris42” has to be recognized by the frontend script as instruction to initialize and open a PhotoSwipe lightbox. So this means, you also need some kind of mapping on the server, that “/page/theansweris42” is not just some page, but refers to a single image inside another page which has to be used instead.

    So – the whole thing would involve a lot of technical challenge and I don’t see the point what you want to achieve with this. The whole idea of the URL parameters is, that they start with “#”, so the browser will still load the page where the image is located and then the frontend script detects, that an image should be opened on this page.

    For another project I did modify the URL pattern to be “#bild-” followed by the number:

    https://fahrradzukunft.de/29/wider-den-konsum/#bild-2

    • This reply was modified 4 years, 10 months ago by Arno Welzel. Reason: Typo
    Thread Starter Obje

    (@harrow)

    Hi Arno,

    Thanks for your quick and complete answer and it seems challenging to get it done.

    So – the whole thing would involve a lot of technical challenge and I don’t see the point what you want to achieve with this.

    My concern was to create simple url to share a photo (website.com/page/theansweris42 seems more relevant than website.com/page/#&gid=1&pid=12 to illustrate H2G2). I guess it could be better for SEO also, no?

    Thank you.

    Plugin Author Arno Welzel

    (@awelzel)

    These URL will not be seen by search engines at all, since they only get generated for the user when opening the lightbox – so users can set a bookmark for specific image if they want to. So there is no need to “optimize” these URLs anyway.

    Thread Starter Obje

    (@harrow)

    Ok I see. Thank you for this information.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL customizing’ is closed to new replies.