Module talk:Excerpt
| Module:Excerpt is permanently protected from editing as it is a heavily used or highly visible module. 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.
|
| This is the talk page for discussing improvements to the Excerpt module. |
|
| Archives: 1, 2, 3, 4Auto-archiving period: 5 months |
| This module does not require a rating on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
| |||||||||||
| To help centralize discussions and keep related topics together, the talk pages for all the transclude excerpt templates redirect here (as of 15 May 2020 UTC): |
Font bug on Apple Safari
[edit]From phab:T413341 by Jengod.
Steps to replicate the issue (include links if applicable):
- use
{{excerpt|Page#Section}}
Example: https://en.wikipedia.org/wiki/Food_of_The_Bear_(TV_series)#Friends_&_Family_Night?useformat=mobile
What happens?:
When viewed on mobile on Safari the last paragraph of the text renders in like 10-pt instead 12-pt
What should have happened instead?:
12-pt version
Screenshots:
Mobile - https://phabricator.wikimedia.org/F71188822
Desktop - https://phabricator.wikimedia.org/F71188823
This article happens to use excerpt template a lot but I've seen this bug before on pages where it's just a one-off * Pppery * it has begun... 16:58, 23 December 2025 (UTC)
- From TheDJ: "Confirmed. The last paragraph is not wrapped in paragraph markup, but should be." * Pppery * it has begun... 16:58, 23 December 2025 (UTC)
- Strangely, this bug seems to happen only in article space, which is concerning because the only difference is the addition of a category towards the end, which definitely shouldn't be removing paragraph markers somehow. I'll see if I can work down to a more refined test case Aidan9382 (talk) 17:15, 23 December 2025 (UTC)
- This seems to be some strange behaviour from the parser to do with text being on the same line as a div. Check the raw html vs the wikitext of this test page (the specific case of this that excerpt is running into is the third case with the category). My main question is, is this excerpt's fault, or is the parser doing weird stuff it shouldn't here? Regardless, I've fixed this in the module by making sure the padding newlines don't get lost when tracking categories get added, which solves the issue. Aidan9382 (talk) 17:30, 23 December 2025 (UTC)
- @Aidan9382 @Pppery just found this resolution by following the breadcrumb trail. Thank you guys so much for fussing with this. I don't understand your magic at all but I do appreciate you!! jengod (talk) 22:04, 20 January 2026 (UTC)
- This seems to be some strange behaviour from the parser to do with text being on the same line as a div. Check the raw html vs the wikitext of this test page (the specific case of this that excerpt is running into is the third case with the category). My main question is, is this excerpt's fault, or is the parser doing weird stuff it shouldn't here? Regardless, I've fixed this in the module by making sure the padding newlines don't get lost when tracking categories get added, which solves the issue. Aidan9382 (talk) 17:30, 23 December 2025 (UTC)
- Strangely, this bug seems to happen only in article space, which is concerning because the only difference is the addition of a category towards the end, which definitely shouldn't be removing paragraph markers somehow. I'll see if I can work down to a more refined test case Aidan9382 (talk) 17:15, 23 December 2025 (UTC)
'only=paragraphs' no longer works for a lead?
[edit]I exerpted the lead of History of self-driving cars into Self-driving car#History and used the "only=paragraphs" parameter, but the article's infobox is showing and I can't work out how to remove it ('files=0' doesn't).
(also posted this on village pump, apologies for cross-posting if that's not allowed). gilgongo (talk) 08:40, 24 December 2025 (UTC)
- I've fixed it with this change - it's generally common practice to not have text on the same lines as the header templates, and excerpt uses this assumption to help it figure out where the actual text starts. When this isn't the case, you can get the weird behaviour you saw. Aidan9382 (talk) 08:55, 24 December 2025 (UTC)
- Thanks for the speedy response! gilgongo (talk) 09:30, 24 December 2025 (UTC)
Failure with Template:Multiple image in infobox
[edit]See User:PrimeHunter/Excerpt test where the excerpt output includes [[File:
|thumb|]]. I think it would be OK to not display an infobox image if it uses {{Multiple image }} but it's bad to display broken code. I saw the issue at Wikipedia:Village pump (technical)#Error with excerpt in the United States-Venezuela relations article. PrimeHunter (talk) 16:41, 5 January 2026 (UTC)
- It's not that it's generating an empty [[File:]] wikilink, but that it's putting the entire multiple image template's text as the target page for the file link, which unsurprisingly ends poorly. The /portals version handles it fine, so perhaps there's something to take from there, though gotta make sure it doesn't break some other case. Aidan9382 (talk) 17:22, 5 January 2026 (UTC)
- The original example was
{{Excerpt|2026 United States strikes in Venezuela}}. Special:ExpandTemplates says the only content of the attempted file link was:
- The original example was
[[File:1 |thumb|]]
- I get that it can be hard to extract something meaningful but maybe it should test whether the extracted file name exists and omit the file link otherwise. PrimeHunter (talk) 18:36, 5 January 2026 (UTC)
2025–2026 Iranian protests: the lead first paragraph is the 11th paragraph
[edit]With the 16:27, 10 January 2026 version of 2025–2026 Iranian protests, {{excerpt|2025–2026 Iranian protests|only=paragraphs|paragraph=11}}, i.e. selecting only the 11th paragraph, is needed to get the brief paragraph Beginning on 28 December 2025, mass demonstrations ... 1979 Islamic Revolution.[refs]
This seems to be a problem with the infobox, based on non-systematically trying some among the 1st to 10th "paragraphs".
In this particular case, with a high-attention article as the source article, it would be unwise to hardwire this to paragraph 11, since infobox evolution is likely to happen, making the excerpts bounce on and off between valid and invalid excerpts and arbitrary i-th paragraphs of the actual lead. Any ideas for a solution that would work now would be welcome (I'm starting a discussion at Template talk:2025–2026 Iranian protests).
This case is likely useful to add to test cases. Boud (talk) 16:38, 10 January 2026 (UTC)
- I looked into this issue and it seems that the cause was that the 16:27, 10 January 2026 version had several wikitext syntax errors, as can be seen by editing the page (with the source editor) and enabling the syntax highlight tool. As those errors were resolved, the paragraph excerpt fixed itself. Sophivorus (talk) 14:29, 12 January 2026 (UTC)
Template:r in source causes cite error when transcluding
[edit]List of immigration raids and arrests in the second Trump presidency (Diff ~1318810311) introduced this error:Cite error: The named reference descend was invoked but never defined
This error existed for nearly 3 months until I just fixed it by getting rid of {{r}}: MacArthur Park (Diff ~1334397423). — Alexis Jazz (talk or ping me) 08:32, 23 January 2026 (UTC)
Error with excerpt template
[edit]On the page Guadalupe River an excerpt from the page July 2025 Central Texas floods is showing formatting for an image thumbnail link in addition to the images (multiple image template). Is it possible to remove the formatting? Thank you @ColinFine for redirecting this post! Tsarivan613 (talk) 19:27, 11 February 2026 (UTC)
Courtesy link: Guadalupe River (Texas) ColinFine (talk) 19:33, 11 February 2026 (UTC)
- I suggested to Tsarivan613 that the problem might be with the templates that are by default excluded from {{Excerpt}}, but I didn't understand what was going on. The material that is not being interpreted is in a {{multiple image}} call. --ColinFine (talk) 20:16, 11 February 2026 (UTC)
- I have added
|files=0to omit transclusion of files.[1] PrimeHunter (talk) 20:19, 11 February 2026 (UTC)
- I have added
Feature request for file excerpts
[edit]It would be nice to use this module to transclude the top image of an article into a table (for example, List of crossings of the Ohio River). Using {{Excerpt|<article>|paragraph=0|file=1|hat=no}} almost does this, but it only renders the image in thumbnail format when it needs to be in basic format. It would be nice to have an option to retrieve the filename only rather than the thumbnail markup, to give flexibility in its layout. Thanks! Antony–22 (talk⁄contribs) 01:50, 5 March 2026 (UTC)
- @Antony-22 That seems very useful and doable. I'll try to implement it later today or tomorrow, cheers! Sophivorus (talk) 11:20, 5 March 2026 (UTC)
- Thanks for the quick turnaround! It would be great for it to return a blank image like File:Noimage.png if there are no images in the target page, to avoid causing markup errors. Antony–22 (talk⁄contribs) 21:26, 5 March 2026 (UTC)
Done Try it out with the following syntax: {{Excerpt|Aristotle|only=filename}}and let me know how it goes. I also implemented the suggested feature that if no image is found, then "Noimage.png" will be returned. Kind regards, Sophivorus (talk) 13:08, 6 March 2026 (UTC)
- Thanks for the quick turnaround! It would be great for it to return a blank image like File:Noimage.png if there are no images in the target page, to avoid causing markup errors. Antony–22 (talk⁄contribs) 21:26, 5 March 2026 (UTC)

@Sophivorus: It seems to work most of the time. But inside a table it causes the file markup to not be recognized (example). Any ideas on how to fix that? Antony–22 (talk⁄contribs) 05:00, 26 March 2026 (UTC)
- Hm, the problem seems to be when the file is in an infobox. I looked at the code but I can't think of an easy fix right now... Sophivorus (talk) 12:07, 26 March 2026 (UTC)
- @Sophivorus:. Okay, it's weirder. In fact, it doesn't work at all in article space, even outside a table or infobox. It works within Visual Editor but not when you save it. It also works when I copy-paste the whole article into my sandbox. Could be an obscure parser issue? Antony–22 (talk⁄contribs) 18:34, 31 March 2026 (UTC)
Template-protected edit request on 7 March 2026
[edit]This edit request to Template:Excerpt has been answered. Set the |answered= parameter to no to reactivate your request. |
When the Intro-excerpt is used in an article, that section may well include additional content. So please modify the wording for the hatnote from:
"This section is an excerpt from..." to "This section includes an excerpt from...". Thank you. Anomalous+0 (talk) 04:32, 7 March 2026 (UTC)
Not done: it's not clear what changes you want made. Please detail the specific changes in a "change X to Y" format and provide a reliable source if appropriate. Zackmann (Talk to me/What I been doing) 05:20, 8 March 2026 (UTC)
Notification of creation of new excerpt template
[edit]Not sure who needs to see this, but just leaving a notification that I created a template that lets you increase/decrease excerpt levels while excerpting. Alexandraaaacs1989 (talk) 16:58, 11 March 2026 (UTC)
- Alexandraaaacs1989, possible duplication or overlap with Template:Conditional heading, although I haven't looked in detail at your new template. Mathglot (talk) 21:43, 15 March 2026 (UTC)
- Thanks for pointing that out! I took a look and my template has some duplicate functionality, but it also has some features not implemented in the other template. Not sure if I have the bandwidth to combine the two, I mainly just needed the template I made for an article I'm working on. But maybe I can get around to merging them soon. Alexandraaaacs1989 (talk) 00:24, 16 March 2026 (UTC)
- @Alexandraaaacs1989 Nice work! I think this functionality could eventually be added to Module:Excerpt too. Cheers! Sophivorus (talk) 12:16, 16 March 2026 (UTC)
Copying the ref tag content verbatim?
[edit]As far as I can tell if the excerpt contains <ref name=Foo/>, the resulting text will include the citation from the excerpted page. The only alternative is no citations at all. I guess there is no option to pass through the markup and let the citation be satisfied by content in the receiving page? Johnjbarton (talk) 01:04, 23 March 2026 (UTC)
- Hi! There currently is no option to do that. Perhaps Help:Labeled section transclusion can work for you. That being said, if I understand your intention correctly, I would advise against doing that, because it might be very confusing for future editors. Kind regards, Sophivorus (talk) 12:50, 23 March 2026 (UTC)
2018–2024 Arab protests
[edit]There's a bug in the excerpt of 2018–2024 Arab protests displayed at Arab Spring § Second Arab Spring (Arab Summer). Daask (talk) 21:49, 3 April 2026 (UTC)
- @Daask Thanks for the report! The bug is caused by the fact that Template:Multiple image is used within the infobox of 2018–2024 Arab protests. It's not easy to fix, so I "solved" it by omitting images from the excerpt altogether (see this diff). Kind regards, Sophivorus (talk) 12:33, 4 April 2026 (UTC)
Unwanted line break
[edit]At Artemis_program#Artemis_Accords, using an excerpt produces an extra line break. I'm not sure where it's coming from; could this be fixed? Sdkb talk 05:10, 6 April 2026 (UTC)
- Unexpectedly, the issue was caused by this extra whitespace. I can't think of a good fix from the module right now, so in the meantime I removed the extra whitespace from the article instead. Thanks for the report! Sophivorus (talk) 13:52, 7 April 2026 (UTC)
Excerpt feed
[edit]Is there anyway to turn off these excerpt templates from displaying the templates on their full articles? For example on the Economy of Canada's section on its automotive sector, the excerpt is displaying all the templates on Automotive industry in Canada. Any way to toggle that off? This issue is prevalent on many articles. Peripteros (talk) 07:55, 15 April 2026 (UTC)
- You can use the
|templates=parameter on a per-use basis (more info at Template:Excerpt § Details) if needed, however to answer your specific case, sidebars like this are normally on a hide-by-default basis, but it just so happens that "Economy of" wasn't a checked-for name. I've added it here, which now hides the specific sidebar template you were talking about by default so you don't have to manually exclude it. Aidan9382 (talk) 10:21, 15 April 2026 (UTC)
