Template:Excerpt
More actions
<languages />
Lua error: bad argument #1 to "get" (not a valid title).{{#if:Lua error: bad argument #1 to "get" (not a valid title). <translate> This template is used for reusing parts of pages in other pages.</translate> <translate> This practice has several advantages:</translate>
<translate>
- Reduces maintenance by avoiding duplicate content that must be updated multiple times</translate>
<translate>
- Improves content quality by encouraging editors to merge related content, rather than having multiple versions in various stages of development</translate>
<translate>
- Fosters collaboration by channeling contributors into one place, rather than working in parallel
This template extends the capabilities of the built-in [[<tvar name=1>Special:MyLanguage/Transclusion</tvar>|normal transclusion]].
Usage
Basic usage
</translate>
{{Excerpt|Page title}}— <translate> Transclude the lead section ([[<tvar name=1>#Lead section</tvar>|example]])</translate>{{Excerpt|Page title|Section title}}— <translate> Transclude a specific section, excluding any subsections ([[<tvar name=1>#Specific section</tvar>|example]])</translate>
<translate>
Parameters
</translate>
1— <translate> Title of the page to transclude.</translate> <translate> Only required parameter.</translate> <translate> By default the lead section will be transcluded ([[<tvar name=1>#Lead section</tvar>|example]]).</translate>2— <translate> Title of the section to transclude ([[<tvar name=1>#Specific section</tvar>|example]]) or name of the [[<tvar name=2>Special:MyLanguage/Extension:Labeled Section Transclusion#How it works</tvar>|<tvar name=3>{{#if:|
|
}}{{#switch:open
|c|close =
|s|single
|o|open
|p|pair = <section{{#if:| {{{params}}}}}
}}{{#switch:open
|c|close =
|s|single = />
|o|open = >
|p|pair = >...
}}{{#switch:open
|s|single
|o|open =
|c|close
|p|pair = </section>
}}{{#if:|
|
}}</tvar> tag]] to transclude.</translate> <translate> Notice that this template provides other ways of targeting specific elements of a page without having to resort to section tags.</translate>
only— <translate> Elements to transclude ([[<tvar name=1>#Files only</tvar>|example]]).</translate> <translate> By default all elements are transcluded.</translate>only=file<translate> or</translate>only=files— <translate> Transclude only files</translate>only=list<translate> or</translate>only=lists— <translate> Transclude only lists</translate>only=table<translate> or</translate>only=tables— <translate> Transclude only tables</translate>only=template<translate> or</translate>only=templates— <translate> Transclude only templates</translate>only=paragraph<translate> or</translate>only=paragraphs— <translate> Transclude only paragraphs</translate>
paragraphs— <translate> Paragraphs to transclude.</translate> <translate> By default all paragraphs are transcluded.</translate>paragraphs=0— <translate> Transclude no paragraphs</translate>paragraphs=1— <translate> Transclude the first paragraph</translate>paragraphs=2— <translate> Transclude the second paragraph</translate>paragraphs=1,3— <translate> Transclude the first and third paragraphs</translate>paragraphs=1-3— <translate> Transclude the first, second and third paragraphs</translate>paragraphs=1-3,5— <translate> Transclude the first, second, third and fifth paragraphs</translate>paragraphs=-1— <translate> Transclude all paragraphs except the first</translate>paragraphs=-2— <translate> Transclude all paragraphs except the second</translate>paragraphs=-1,3— <translate> Transclude all paragraphs except the first and third</translate>paragraphs=-1-3— <translate> Transclude all paragraphs except the first, second and third</translate>paragraphs=-1-3,5— <translate> Transclude all paragraphs except the first, second, third and fifth</translate>
lists— <translate> Lists to transclude.</translate> <translate> By default all lists are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs.</translate>files— <translate> Files to transclude.</translate> <translate> By default all files are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>files=A.jpg— <translate> Transclude the file named '<tvar name=1>A.jpg</tvar>'</translate>files=A.jpg, B.png, C.gif— <translate> Transclude the files named '<tvar name=1>A.jpg</tvar>', '<tvar name=2>B.png</tvar>' and '<tvar name=3>C.gif</tvar>'</translate>files=.+%.png— <translate> Transclude all PNG files</translate>files=-A.jpg— <translate> Transclude all files except the one named '<tvar name=1>A.jpg</tvar>'</translate>files=-A.jpg, B.png, C.gif— <translate> Transclude all files except the ones named '<tvar name=1>A.jpg</tvar>', '<tvar name=2>B.png</tvar>' and '<tvar name=3>C.gif</tvar>'</translate>files=-.+%.png— <translate> Transclude all non-PNG files</translate>
tables— <translate> Tables to transclude.</translate> <translate> By default all tables are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>tables=Stats2020— <translate> Transclude the table with id '<tvar name=1>Stats2020</tvar>'</translate>tables=Stats2020, Stats2019, Stats2018— <translate> Transclude the tables with ids '<tvar name=1>Stats2020</tvar>', '<tvar name=2>Stats2019</tvar>' and '<tvar name=3>Stats2018</tvar>'</translate>tables=-Stats2020— <translate> Transclude all tables except the one with id '<tvar name=1>Stats2020</tvar>'</translate>tables=-Stats2020, Stats2019, Stats2018— <translate> Transclude all tables except the ones with ids '<tvar name=1>Stats2020</tvar>', '<tvar name=2>Stats2019</tvar>' and '<tvar name=3>Stats2018</tvar>'</translate>
templates— <translate> Templates to transclude.</translate> <translate> By default all templates are transcluded.</translate> <translate> Same syntax as when transcluding paragraphs, but also:</translate>templates=Infobox— <translate> Transclude the template '<tvar name=1>Infobox</tvar>'</translate>templates=Infobox, Navbox, Chart— <translate> Transclude the template '<tvar name=1>Infobox</tvar>', '<tvar name=2>Navbox</tvar>' and '<tvar name=3>Chart</tvar>'</translate>templates=-Infobox— <translate> Transclude all templates except '<tvar name=1>Infobox</tvar>'</translate>templates=-Infobox, Navbox, Chart— <translate> Transclude all templates except '<tvar name=1>Infobox</tvar>', '<tvar name=2>Navbox</tvar>' and '<tvar name=3>Chart</tvar>'</translate>
this— <translate> Change the initial text of the hatnote. For example, if the transcluded content is a gallery, you can set <tvar name=1>this=This gallery is</tvar> so that the hatnote reads "This gallery is an excerpt from..."</translate>displaytitle— <translate> Change the text of the link in the hatnote. For example to add italics, subscripts, etc.</translate>hat=no— <translate> Hide the hatnote "This section is an excerpt from..."</translate>more=yes— <translate> Show a "Read more..." link at the end</translate>bold=yes— <translate> Keep bold text.</translate>quote=yes— <translate> Wrap the excerpt with <tvar name=1>{{#if:|
|
}}{{#switch:open
|c|close =
|s|single
|o|open
|p|pair = <blockquote{{#if:| {{{params}}}}}
}}{{#switch:open
|c|close =
|s|single = />
|o|open = >
|p|pair = >...
}}{{#switch:open
|s|single
|o|open =
|c|close
|p|pair = </blockquote>
}}{{#if:|
|
}}</tvar> tags.</translate>
inline=yes— <translate> Remove the hatnote and <tvar name=1>{{#if:|
|
}}{{#switch:open
|c|close =
|s|single
|o|open
|p|pair = <div{{#if:| {{{params}}}}}
}}{{#switch:open
|c|close =
|s|single = />
|o|open = >
|p|pair = >...
}}{{#switch:open
|s|single
|o|open =
|c|close
|p|pair = </div>
}}{{#if:|
|
}}</tvar> tags around the excerpt, to use it inside other text.</translate>
references=no— <translate> Remove all references.</translate>subsections=yes— <translate> Include subsections of the transcluded section. Notice that if the transclusion is done from a section level 3, and the transcluded subsections are level 3 too, then the transcluded subsections will show with the same hierarchy as the transcluding section, which is probably not desirable, so use with caution.</translate>
<translate>
Replacing a section with an excerpt
</translate>
<translate> A section is often a summary of a more precise page dealing with a subtopic.</translate> <translate> Sometimes it's convenient to replace the content of such a section with an excerpt of the page about the subtopic, after merging the original content of the section (if any) into the page about the subtopic.</translate> <translate> This improves both the page about the subtopic and the section, reduces maintenance, drives contributors to collaborate, etc.</translate>
<translate> An efficient way to proceed is:</translate>
<translate>
- Open the section for editing in one tab, and the page about the subtopic in another.</translate>
<translate>
- Copy the text of the section and append it to the lead of the page about the subtopic.</translate>
<translate>
- Consolidate and adjust the combined lead using common sense.</translate>
<translate>
- Save the changes in the child article with an edit summary like: Copied content from <tvar name=1>[[Page]]</tvar>; see that article's history for attribution.</translate>
<translate>
- Back in the section, delete all content and replace it with an excerpt of the page about the subtopic.</translate>
<translate>
- Save the changes in the section with an edit summary like: Move content to <tvar name=1>[[page about the subtopic]]</tvar> and leave an excerpt.
Examples
Lead section
</translate>
{{Excerpt|Lorem ipsum}}
| references-column-width
| references-column-count references-column-count-{{#if:1|{{{1}}}}} }}
| {{#if:
| references-column-width }} }}" style="{{#if:
| {{#iferror: {{#ifexpr: 1 > 1 }}
| column-width: 30em;
| column-count: 2; }}
| {{#if:
| column-width: 30em; }} }} list-style-type: {{#switch:
| upper-alpha
| upper-roman
| lower-alpha
| lower-greek
| lower-roman = {{{group}}}
| #default = decimal}};">
<references group=""></references><translate>
Specific section
</translate>
{{Excerpt|Lorem ipsum|Section}}
<translate>
Files only
</translate>
{{Excerpt|Lorem ipsum|only=files|hat=no}}
<translate>
Infobox only
</translate>
{{Excerpt|Extension:CategoryLockdown|only=templates|templates=Extension|this=This infobox is}}
Lua error: bad argument #1 to "get" (not a valid title).
<translate>
No infobox
</translate>
{{Excerpt|Extension:CategoryLockdown|templates=-Extension}}
Lua error: bad argument #1 to "get" (not a valid title).
<translate>
Portal
</translate>
{{Excerpt|Lorem ipsum|files=1|references=no|hat=no|more=yes}}
<translate>
See also
</translate>
<translate>
Template data
</translate> Lua error: bad argument #1 to "get" (not a valid title).| [[Category:Template documentation pages{{#translation:}}]] }}