I see the ability to add a caption by adding it when building the array:
var openGallery1 = function() {
var pswpElement = document.querySelectorAll('.pswp')[0];
// build items array
var items = [
{
src: 'img/photos/photo1.jpg',
title: 'Title for Photo 1',
w: 800,
h: 555
},
etc, etc
Is there a way to also add alt text? I would like to have it for improved SEO since the site won't have much text on it.
You won't get any SEO benefit from alt tag in dynamically generated image after a few seconds from page load.
Follow this guide - http://photoswipe.com/documentation/seo.html
Alt text isn't just for SEO - it's also important for users who are blind or low-vision and navigate using the screenreader. If I wanted to add this in, where would I start?
The alt for images is important for WCAG 2.0
https://www.w3.org/TR/WCAG20-TECHS/F38
https://www.w3.org/TR/WCAG20-TECHS/F65
https://www.w3.org/TR/WCAG20-TECHS/H37
As discussed above, alt text support is not only desirable for SEO reasons. Accessibility is also a concern. I have come across a scenario in which the lack of alt text was being counted against a website in an accessibility scan. I have submitted a pull request that allows for alt text to be added in the same way a title is added: https://github.com/dimsemenov/PhotoSwipe/pull/1703
Most helpful comment
Alt text isn't just for SEO - it's also important for users who are blind or low-vision and navigate using the screenreader. If I wanted to add this in, where would I start?