{{Excerpt|Page title}} – Transclude the lead section (example)
{{Excerpt|Page title|Section title}} – Transclude a specific section, excluding any subsections (example)
Parameters
There is one required parameter, and numerous optional ones for configuring the excerpt:
Summary
Source identification
|1= – Name of the article or page to transclude.Required. Aliases:|article= or|page=.
|2= – Name of the section or tag to transclude. Optional; if omitted, transcludes the lead section (content above the first section header). Aliases:|section= or|fragment=.
Transclusion config
Transcludable content is defined as one of severalelement types:file,list,paragraph,reference,subsection,table, ortemplate. Config parameters specify whichelement type to transclude, and in some cases,how many andwhich items of that type to transclude. All config parameters are optional; if omitted, all items of all element types are transcluded from the source page identified by the two unnamed parameters. Some element types support conditional item transclusion by specifying an item number range (1-3) or comma series (1, 2, 5); these types include: files, lists, paragraphs, and tables.
There are ten optional transclusion configuration parameters:
|only= – Element types to transclude. Values:file(s),list(s),table(s),template(s),paragraph(s). Default: all element types.
|files= –Files to transclude. Default: all files. Same basic syntax as|paragraphs=, but see§ Details.
|subsections=yes – Includesubsections of the transcluded section. Default: only content above the first subsection header.
|tables= –Tables to transclude. Default: all tables. Same basic syntax as|paragraphs=, but see§ Details.
|templates= –Templates to transclude. By default all templates are transcluded, except those blacklisted atModule:Excerpt/config. See§ Details for how to specify a specific template or templates for inclusion or exclusion.
Style and extra features
These optional parameters alter the way transcluded items are displayed:
|bold=yes – Preservebold text.
|briefdates=yes – Abbreviate birth and death information to (YYYY-YYYY) format
|displaytitle= – Change the text of the link in the hatnote. For example,add italics, subscripts, etc.
|hat=no – Hide thehatnote "This section is an excerpt from..."
|inline=yes – Remove the<div> tags around the excerpt, to use it inside other text, or to add references or other content after itwith no paragraph break between them. Also hides the hatnote; to reestablish it, use{{transclusion notice}} above the Excerpt invocation.
|quote=yes – Wrap the excerpt with<blockquote> tags.
|this= – Change the initial text of the hatnote. For example, if the transcluded content is a gallery, you can set|this=This gallery is so that the hatnote reads "This gallery is an excerpt from..."
Details
|1= or|article= or|page=
By default the lead section is transcluded (example). If the page contains an infobox, the image and caption of the infobox will be transcluded (unless|files=0 is set). Also, templates listed atModule:Excerpt/config will not be transcluded (unless requested explicitly with|templates=, see below).
|2= or|section= or|fragment=
Name of the section to transclude (example) or of the<section> tag to transclude (example). In the case of a section tag, the section must be marked with<section begin="Name of the fragment" /> and<section end="Name of the fragment" /> in the page to be transcluded. Notice that this template provides other ways of targeting specific fragments of a page without having to resort to section tags.
|only=
Theelement type to transclude, excluding all other types. By default all element types are transcluded. Param|only= is an exclusionary param, and excludes all other types of elements, except the one you name, so that for example, specifying|only=paragraphs excludes all lists, tables, templates, and so on. Param values can be in the singular (e.g.,|only=paragraph) or plural (e.g.,|only=paragraphs) and mean different things: in the singular, only the first item of that element type is transcluded; in the plural, all items are.
|only=file – Transclude only the first file (but no lists, paragraphs, tables, etc.)
|only=files – Transclude all files (but nothing else)
|only=list – Transclude only the first list, exclude all other element types
|only=lists – Transclude all lists (but nothing else)
|only=table – Transclude only the first table, exclude all other element types. Does not transclude table templates, use|templates= for that.
|only=tables – Transclude all tables (but nothing else) (example)
|only=template – Transclude only the first template (excluding templates blacklisted atModule:Excerpt/config, as well as all other element types)
|only=paragraph – Transclude only the first paragraph, exclude all other element types
|only=paragraphs – Transclude all paragraphs (but nothing else)
|files=
Anelement item param, defining which files, such as images and other media, to transclude. Default: all files.
|files=0 – Transclude no files
|files=A.jpg – Transclude the file named 'A.jpg'
|files=A.jpg, B.png, C.gif – Transclude the files named 'A.jpg', 'B.png' and 'C.gif'
|files=.+%.png – Transclude all PNG files
|files=-A.jpg – Transclude all files except the one named 'A.jpg'
|files=-A.jpg, B.png, C.gif – Transclude all files except the ones named 'A.jpg', 'B.png' and 'C.gif'
|files=-.+%.png – Transclude all non-PNG files
|paragraphs=
Anelement item param, defining which paragraphs to transclude. By default all paragraphs are transcluded.
|paragraphs=0 – Transclude no paragraphs
|paragraphs=1 – Transclude the first paragraph
|paragraphs=2 – Transclude the second paragraph
|paragraphs=1,3 – Transclude the first and third paragraphs
|paragraphs=1-3 – Transclude the first, second and third paragraphs
|paragraphs=1-3,5 – Transclude the first, second, third and fifth paragraphs
|paragraphs=-1 – Transclude all paragraphs except the first
|paragraphs=-2 – Transclude all paragraphs except the second
|paragraphs=-1,3 – Transclude all paragraphs except the first and third
|paragraphs=-1-3 – Transclude all paragraphs except the first, second and third
|paragraphs=-1-3,5 – Transclude all paragraphs except the first, second, third and fifth
|subsections=yes
Anelement item param, defining which subsections of the source to transclude. Default: only the portion of the source lying above the first subsection header. Notice that if the transclusion is done from a section level 3 in the transcluding page, and the transcluded subsections are also level 3, then transcluded subsections will show with the same hierarchy as the transcluding section, which may not be the desired outcome, so use with caution.
|tables=
Anelement item param, defining which tables to transclude. Default: all tables. Does not transclude table templates just above the tables. Same syntax as when transcluding paragraphs, but also:
|tables=Stats2020 – Transclude the table with id 'Stats2020'
|tables=Stats2020, Stats2019, Stats2018 – Transclude the tables with ids 'Stats2020', 'Stats2019' and 'Stats2018'
|tables=-Stats2020 – Transclude all tables except the one with id 'Stats2020'
|tables=-Stats2020, Stats2019, Stats2018 – Transclude all tables except the ones with ids 'Stats2020', 'Stats2019' and 'Stats2018'
|templates=
Anelement item param, defining which templates to transclude. Default: all templates except those blacklisted atModule:Excerpt/config. Using a hyphen (minus sign) before a comma-delimited list of templates excludes those templates from transclusion.
|templates=-Ocean – Add the template 'Ocean' to the blacklist
|templates=-Ocean, Nature – Add the templates 'Ocean' and 'Nature' to the blacklist
|templates=Infobox person – Ignore the blacklist and transclude the template 'Infobox person'
|templates=Infobox person, Ocean – Ignore the blacklist and transclude the templates 'Infobox person' and 'Ocean'
|templates=.* – Ignore the blacklist and transclude all templates
For simple cases of transcluding sections of articles, the {{#section}}, {{#section-x}}, and {{#section-h}} (abbreviated {{#lst}}, {{#lstx}}, and {{#lsth}})) parser functions can be used instead of this template. {{#lsth:article|fragmentname}} will transclude the section of "article" with the header "fragmentname", and {{#lsth:article}} will transclude the lead section of "article". Excerpting only specific paragraphs can be done by marking up the source article with<section begin=fragmentname/>...<section end=fragmentname/> tags and using {{#lst:article|fragmentname}} to transclude those fragments, which is equivalent to using the|fragment=fragmentname parameter with this template. {{#lsth:article|fragmentname}} can also be used to transclude everythingbut those fragments.
The text will not be trimmed of excess whitespace, there will not be a header (equivalent to|hat=no, and all files, templates, tables, references, and subsections will be included unless the source article is marked up with<section begin=fragmentname/>...<section end=fragmentname/>,<noinclude>...</noinclude>, or<onlyinclude>...</onlyinclude> tags.Self links will appear in bold.
It can happen that the source you want to excerpt contains footnotes in adifferent citation style than your article, and excerpting the source would cause a citation style mismatch, which is contrary to the guideline onciting sources. Sometimes, excerpt can still be used, while avoiding a mismatch in style, by the use of params|references=no and|inline=yes.
If the source you want to excerpt has multiple ref-tags interspersed throughout the source, and they need to display exactly in those locations in order to maintain fullverifiability, then this source might not be a good candidate for transclusion via the{{excerpt}} template, andcopying the content from the source into the article might be a better choice.
However, you can still use the Excerpt template, if the source page you want to excerpt meetseither of these conditions:
references are found mostly or all at the end of the text to be excerpted; or
references are scattered throughout, but could legitimately be regrouped at the end of the excerpt without adversely affectingverifiability.
In either case, use params|references=no to strip the ref-tags from the transcluded content, and|inline=yes to define the excerpt as aninline display element in order to§ Suppress line breaks between paragraphs, and then manually append a copy of all the citations in the source immediately after the excerpt tag ending curly braces in the target article, with no intervening line breaks, white space, or other characters between the tag and the appended references. The copied references will have to be manually converted fromshort footnote-style to full, inline citation-style, or vice-versa, to match the citation style of the target.Note: citations are not creative content, andattribution is not needed for copying them.
Another approach
It is advised to seek consensus before attempting this layout change.
If there are few shortened footnotes, a new subsection can be added to the "References" section to allow{{sfn}} to link to the correct citations. Here is one approach, where the{{sfn}} citations list in the excerpted article "SCBA" is titled "Works cited":
{{sfn}} footnotes will now link to the citations created in the excerpted subsection.
Ref name collision
To prevent the possibility of collisions betweennamed references in the transcluding and excerpted pages which would otherwise generate aduplicate key error, all ref names in the excerpted content are altered by prefixing the name with the pagename of the excerpted page. Thus, if the ref on pageMyArticle looks like<ref name="Jones-2024">, then when excerpted byTargetPage it will be changed to<ref name="MyArticle Jones-2024">, in order to avoid a collision with a possible "Jones-2024" ref already on the target page.
Excerpt trees
Visual representation of an imaginary excerpt tree.
When a very general article uses excerpts from more specific articles, which in turn use excerpts from even more specific articles, then atree structure emerges, called an "Excerpt tree".
Here you can navigate the main excerpt trees on the English Wikipedia. It's useful for editors interested in expanding or improving them. To navigate the trees, click the following button(S):
Sometimes, a passage will almost fit for a transclusion, but not quite. In these cases, you can edit the source page to add<noinclude>...</noinclude> tags around content you don't want in the excerpt and<includeonly>...</includeonly> tags around content you want only in the excerpt.
For instance, the pageCOVID-19 misinformation begins with "TheCOVID-19 pandemic has resulted inmisinformation...". However, when excerpting this lead to the misinformation section ofCOVID-19 pandemic, we don't need to specify which pandemic we're referring to. Therefore, the codeThe <noinclude>[[COVID-19 pandemic]]</noinclude><includeonly>pandemic</includeonly> has resulted in [[misinformation]] can be used at the misinformation page, so that it will appear at the pandemic page as "The pandemic has resulted inmisinformation...".
For pages with a high volume of edits, it may be a good idea to leave a hidden comment explaining why the tags are there, so that no one will betempted to remove them, like so:The <noinclude>[[COVID-19 pandemic]]</noinclude><!--These tags are used to refine the excerpt at [[COVID-19 pandemic]]--><includeonly>pandemic</includeonly> has resulted in [[misinformation]]
Please note that when the</noinclude> tag is wrapped into a new line, a character next to it would be interpreted as a line beginning. This can lead to some formatting problems. For example, when a</noinclude> at line beginning is succeeded by awhitespace character, the page engine would translate this as aleading space that renders the subsequent paragraph incode block andmonospaced font with preserved formatting. For this reason, no spaces should separate the</noinclude> tag from the text it precedes.
Replacing summary section with excerpt of child article
How to replace a section with an excerpt.
A section is often asummary in aparent article of a more detailed page about a subtopic located in achild page; these are generally linked withTemplate:Main in the parent. Sometimes it's convenient to replace the content of such a summary section in the parent with an excerpt of the child page lead (after merging any valuable content of the section into the child page). In such cases, an efficient way to proceed is:
Open the parent section for editing in one tab, and the child article in another.
Copy the text of the parent section and append it to the lead section of the child page.
Consolidate and adjust the combined lead using common sense.
Save the changes in the child article with anedit summary like: "Copied content from [[Page]]. See that article's history for attribution."
Back in the parent page section, delete all content except the section header and replace it with an excerpt of the child page.
Save the changes in the section; proposed edit summary: "Moved section content to [[Child page title]] and replaced with excerpt."
IMPORTANT: In step four, include thefull edit summary as shown to comply with Wikipedia'scopyright policy. If you forget to do this at the time of the original edit, follow the instructions onRepairing insufficient attribution to create a dummy edit with the required edit summary.
Suppress line breaks between paragraphs
If you want to merge two excerpted paragraphs from a source into one longer one in your article, use two excerpts instead of one, and change the display mode toinline. So, for example, instead of this :
{{excerpt|Ocean color|paragraphs=2-3|file=no}} // (example taken fromOcean#Color)
and this will remove theline break between the two paragraphs, so they will render as one paragraph.
By default, an{{excerpt}} generates an HTMLdiv-tag, which is ablock-level display element, so contiguous excerpts are normally separate block elements with line breaks between them. This can be overridden through use of param|inline=yes, which suppresses the div-tag, and results in aninline display element instead. In this case, just as with running text on adjacent lines ofwikicode, no line break is generated between them.This technique can also be adapted to§ change citation style or use different references.
Mitigating side effects of unexpected source file changes
Excerpting content from a source page section into a target may causelink rot and other undesirable effects in the target if the heading or source content changes unexpectedly. Editors of the source page are generally unaware that editing the source can have side effects elsewhere. This situation can be mitigated by adding ahidden text message at the source page section being excerpted:
<!-- Note: Content in this section is {{excerpt}}ed by "PageName#SectionName". See TM:HIDDENEXCERPTADVICE. -->
This alerts editors of the source file that part or all of the content in the area below the message is excerpted onto another page, so the editor can take target page side effects into account during their edit. Changing the heading is analogous toMOS:HIDDENLINKADVICE, which describes how to avoid undesirable side effects when a section heading change may lead to a broken redirect.
What to do
If you are about to edit a section that contains a hidden excerpt advice message, what should you do?
If your prospective changes are typos, grammar, or wording adjustmentswithout changing the section heading, most likely you don't need to do anything
If you are changing the section heading, then this will likely break the{{excerpt}} and leave an error message at the target page. Have a look at the indicated source page and find the{{excerpt}} template. If it contains a pointer to the old section heading name on the source page section (seepositional parameter 2), then you should update that parameter to the new section name.
If you are making a substantial change to excerpted content at the source in a way that may adversely affect the target page, you could:
raise a discussion at the target Talk page, to advise editors about changes to the source; you could linkTM:HIDDENEXCERPTADVICE in the discussion or in the edit summary
replace the{{excerpt}} template in the target with contentcopied from the version of the source before you changed it. (Don't forget to providecopy attribution in the edit summary). This is a permanent solution for that excerpt, and you should remove the hidden link from the source page after completing it.
Advantages and disadvantages
The use of{{Excerpt}} has the following advantages:
Reduces maintenance by avoiding duplicate content that must be updated multiple times
Fosters collaboration by channeling contributors into one place, rather than working in parallel
Promotes rapid development of articles, especially those written insummary style
It also has the following disadvantages:
Impediment to editing as you have to go to the sub article to make changes to the main article (though excerpts include a hatnote with an [edit] button to edit the excerpted article in one click)
Issues in template{{R}} make it incompatible with the{{excerpt}} template.{{r}} should not be used in sections that will be transcluded by{{excerpt}}.
Error messages
If an error is detected, an error message will appear in the article in place of the expected transcluded content:
No page given – No page was passed to the template
Title X is not valid – The title passed is not valid (containsforbidden characters such as < or >)
Page X not found – The page passed does not exist, or the page is a redirect and the target page was not found
Lead section is empty – The page exists, but cannot excerpt from non-existent lead
Section X not found – The page exists, but cannot excerpt the desired section because either:
The given section does not exist. This may occur if the source page section is removed or renamed. To help mitigate this, seeMOS:BROKENSECTIONLINKS.
The given section exists, but is excluded from transclusion by one of theinclusion control tags.
Section X is empty – The given section exists, but is empty
Template loop detected – The excerpted section contains itself an excerpt. While this is not strictly a template loop, the software considers it so. To fix it, skip the intermediate excerpt (example).