Jump to content

Template talk:Gallery

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 1 month ago by RoySmith in topic Why do we support packed-hover?

[edit]

@Jonesey95 Hmmm, sorry about that erroneous edit to the doc saying captions don't accept external links when it appears they do in my sandbox, but possibley not on talk pages... like on this talk page in the past the source code for the gallery at the section header titled "Proposal: clarify "user-generated" in MOS:CALLIGRAPHY" is:

{{Gallery
| title        = Examples of a "digital recreation" and of "stylistic elements which are not present in the original":
| align        = center
| footer       =
| style        =
| state        =
| height       =
| width        = 
| perrow       =
| mode         = 
| whitebg      = no
| noborder     = yes
| captionstyle =
| File:Istanbul - Santa Sofia - Medalló (cropped).JPG
 | real-world calligraphy of [[Ali]]
 | alt1=
| File:Rashidun Caliph Ali ibn Abi Talib - علي بن أبي طالب.svg
 | digital recreation of real-world calligraphy of Ali
 | alt2=
| File:UsulALFiqh.svg
 | calligraphy containing stylistic elements (decorative circle, color, shadow) not present in original calligraphy as used outside WP (external links [https://m.media-amazon.com/images/I/71iObLPx1mL._SL1500_.jpg][https://www.mehbooba.com/the-principles-of-hanafi-usul-al-fiqh][https://madinahcollege.uk/product/usul-al-fiqh-an-introduction-to-islamic-legal-theory])
 | alt3=
}}

See the highlighted caption doesn't appear on the page. Is it a talk page only thing? Or is it specifically the code of this caption that is causing it not to output? waddie96 ★ (talk) 20:23, 9 February 2025 (UTC)Reply

A bit of a mystery. See this test case, where the first external link appears to suppress the entire caption. The same link with link text works fine. – Jonesey95 (talk) 21:13, 9 February 2025 (UTC)Reply
Arthurfragoso, I think this may be related to your alt text changes. The alt text for the above contains unprocessed URLs that appear to be interfering with rendering of the caption; when I remove the alt text from the rendered gallery, the links above display just fine. – Jonesey95 (talk) 21:18, 9 February 2025 (UTC)Reply
@Arthurfragoso yes appears so. waddie96 ★ (talk) 23:30, 9 February 2025 (UTC)Reply
Alt text must not contain external links. This is because the alt text is carried in the alt= attribute of the <img /> tag; and attribute values cannot contain markup of any kind. See HTML5 spec, section 4.7.1.1 (it's quite lengthy). --Redrose64 🌹 (talk) 23:52, 9 February 2025 (UTC)Reply
I have reverted the last twoall of the February changes, which appears to resolve the problem until Arthurfragoso can come up with a better fix in the sandbox. – Jonesey95 (talk) 02:33, 10 February 2025 (UTC)Reply
But the above example contains no external links in the alt text... or if I'm missing the bigger picture here then excuse me because I know nothing of Module coding. waddie96 ★ (talk) 09:35, 10 February 2025 (UTC)Reply
@Jonesey95, @Waddie96:
The problem was because the url was concatenating with the pipe, and the parser was interpreting the pipe as part of the url, example:
alt1=caption with link at the end http://website.com/about|caption with link at the...
So now I added a code to strip the links added to the alt text, and I also added a space before the caption to prevent other unexpected behavior. -- Arthurfragoso (talk) 10:21, 10 February 2025 (UTC)Reply
@Waddie96: Thanks for reporting! I have just put the updated code live. -- Arthurfragoso (talk) 10:34, 10 February 2025 (UTC)Reply
@Arthurfragoso Awesome, thanks for the quick fix and your help! waddie96 ★ (talk) 21:06, 10 February 2025 (UTC)Reply

Vertical alignment

[edit]

Is is possible to vertically align images? PhotographyEdits (talk) 11:00, 9 March 2025 (UTC)Reply

[edit]

I feel like it's weird and arbitrary that the footer is aligned right by default. It just makes the footer unsuitable for long text that wraps to the next line. Should there be an option that lets you change the alignment setting of the footer (right, center, left)? Nrco0e (talkcontribs) 06:39, 11 September 2025 (UTC)Reply

Why do we support packed-hover?

[edit]

I recently told @Crisco 1492 in WP:Featured article candidates/George F. Durand/archive1 to remove a hover directive because it is contraindicated by MOS:NOHOVER for various accessability reasons. Digging a little deeper, I see that this is supported by {{Gallery}} and that Help:Gallery tag even encourages it, saying that it "degrades gracefully on screen readers". So what's the real story here? Is packed-hover legit or not? RoySmith (talk) 19:03, 18 June 2026 (UTC)Reply