Template talk:Gallery
Add topic| Template:Gallery is indefinitely protected from editing, as it is a heavily used or highly visible template. Substantial changes should first be proposed and discussed here on this page. If the proposal is uncontroversial or has been discussed and is supported by consensus, editors may use {{edit template-protected}} to notify an administrator or template editor to make the requested edit. Usually, any contributor may edit the template's documentation to add usage notes or categories.
Any contributor may edit the template's sandbox. Functionality of the template can be checked using test cases. |
| This is the talk page for discussing improvements to the Gallery template. |
|
| Archives: 1, 2Auto-archiving period: 3 months |
| This template does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||
| ||||||||
Caption not accepting external links
[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)
- 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)
- 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)
- @Arthurfragoso yes appears so. waddie96 ★ (talk) 23:30, 9 February 2025 (UTC)
- 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)- 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) - 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)
- @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)
- @Waddie96: Thanks for reporting! I have just put the updated code live. -- Arthurfragoso (talk) 10:34, 10 February 2025 (UTC)
- @Arthurfragoso Awesome, thanks for the quick fix and your help! waddie96 ★ (talk) 21:06, 10 February 2025 (UTC)
- @Waddie96: Thanks for reporting! I have just put the updated code live. -- Arthurfragoso (talk) 10:34, 10 February 2025 (UTC)
- I have reverted
- Alt text must not contain external links. This is because the alt text is carried in the
- @Arthurfragoso yes appears so. waddie96 ★ (talk) 23:30, 9 February 2025 (UTC)
- 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)
Vertical alignment
[edit]Is is possible to vertically align images? PhotographyEdits (talk) 11:00, 9 March 2025 (UTC)
Align footer left
[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 (talk • contribs) 06:39, 11 September 2025 (UTC)
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)