Help talk:Substitution

Jump to navigation Jump to search

About this board

Summary by Retro

Substitution can only be applied to a template by using subst:; it can't be implicitly inferred when transcluding a template. On the English Wikipedia, certain templates are automatically substituted by bots.

أحمد (talkcontribs)

I have been re-reading this for a year now and I must be very thick because I'm unable to answer a very basic question:

Is it possible to create a template T that, when included normally in page P, would substitute some of its output in page P?


Is it possible to create a template T1 that, when included normally in page P, would substitute the output of another template T2 in page P?

I.e is it possible to hide the mechanics of substitution of the layuser who would continue to use templates as they normally would?

RobinHood70 (talkcontribs)

While I'm no substitution expert, I'm reasonably sure the answer is "no" to both of these. The end user has to decide whether they're substituting or not; after that, however, a template can certainly control how it responds to a request to be substituted (or if it's not substituted but should be).

Retro (talkcontribs)

I'm no substitution expert either, but I concur the answer is "no" based on discussion I've seen elsewhere and my general intuition about how the wikitext parser works.

The issue come down to the very nature of substitution. subst: is special because it gets processed earlier than anything else. subst: can't be added on a page through transclusion, because the text containing subst: would be expanded later in the page parsing process, thus ineligible to be interpreted as a proper substitution. Therefore it seems that the only way to trigger a template substitution is explicitly by the editor using the template.

However, this not mean there can't be multi-level cascading substitution; I believe it is possible for a template that is marked with subst: to trigger templates it uses to subst: as well.

How to add a code only when transluding, but hide it when substituting?

Summary by Dvorapa

Found the answer inside enwiki's is/ifsubst templates

Dvorapa (talkcontribs)


How to do a template that use the USEREDITOR as a signature ?

Summary by Dvorapa

Use <includeonly>

Orthophilos (talkcontribs)

I' m trying to create a seal of "notorious article" to be used for sysops that approve some article. I created a template called {{Template:NotoriousArticle}} the Idea is some thing like {{Approved by {{subst:{{REVISIONUSER}}}}}} , When the sysop call notoriousArticle the text have to be replaced just in the article and not in the template. Anyone could help me ?

Messerjokke79 (talkcontribs)

try <includeonly>.

2804:14C:65D3:4213:10E:10F3:A232:680C (talkcontribs)


Orthophilos (talkcontribs)


There are no older topics