Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 16:56, 8 March 2025 by Prd (talk | contribs) (Created page with "{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> {{Notice|This template is used by Template:WPBannerMeta. Please discuss at Template talk:WPBannerMeta before making any changes.}} {{transclusionless|reason=it is used when templates are substituted, often inside {{tag|includeonly}} tags. This template's name appears in the wikitext of [https://en.wikipedia.org/w/index.php?search=insource%3A%2Fsubstcheck%2F&title=Sp...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This template can be used in conditional processing in other templates to detect substitutions.

If you use Module:Unsubst, you need not use this template.

Usage

If you put <includeonly>{{subst:</includeonly><includeonly>substcheck}}</includeonly> into a template, it will expand into one of the following, depending how the template is being viewed.

  • SUBST if the template is being substituted
  • {{subst:substcheck}} if the template is being transcluded
  • Empty string if you are viewing the template page.

Using this template differently may yield different results; the above is the most universal way.

Lua replacement

if mw.isSubsting() then
	-- substituting: "SUBST"
elseif mw.getCurrentFrame():getParent():getTitle() == mw.title.getCurrentTitle().fullText then
	-- viewed directly: ""
else
	-- transclusion: "{{subst:substcheck}}"
end

See also