Template:Find substed/doc

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Generate a Cirrus search url that returns pages containing the name of a given substed template, as long as the template places its own name on the page embedded in a hidden comment, as for example, the user warning and welcome templates typically do.

{{Find substed}}
{{fsubst|Template name}}
{{fsubst|Template name|year=YYYY}}
{{fsubst|Some string|sns=Help talk}}

Parameters

[edit source]

There are four optional parameters:

  • |1= – name of template or string to search for (optional; default = {{PAGENAME}}; i.e., name of page where it appears)
  • |year= – restricts the search to the year you specify (optional; default = all years; see § Notes)
  • |ns= – namespace name of template or string (optional; default = Template
  • |sns= – search namespace: what namespace to search (list) for the given template (optional; default = User talk; see § Notes)
    the special value all (i.e., |sns=all) may be used to search all namespaces simultaneously

When used with no parameters, it searches the User talk space for hidden text containing the name of the page it is transcluded on.

Interactions: for interaction of certain parameters, such as sns and year, see the § Notes section below.

Examples

[edit source]
  • [{{find substed}} search] ⟶ search User talk for this template (0 results)
  • [{{find substed|uw-vandalism4}} search] ⟶ search User talk for template uw-vandalism4
  • [{{find substed|uw-vandalism4|year=2026}} search] ⟶ search User talk for template uw-vandalism4
  • [{{fsubst|uw-spam4im}} search] ⟶ search User talk for uw-spam4im
  • [{{fsubst|Uw-c&pmove}} search] ⟶ search User talk for Uw-c&pmove
  • [{{fsubst|Uw-c&pmove|year=2024}} search] ⟶ search User talk for Uw-c&pmove
  • [{{fsubst|Notified|sns=Wikipedia|year=2022}} search] ⟶ search Wikipedia namespace for Notified     (invalid; see § Year search issues)
  • [{{fsubst|Notified|sns=all}} search] ⟶ search all namespaces for Notified
  • [{{find substed|RFDNote|sns=Help talk}} search] ⟶ search Help talk for RFDNote

Method

[edit source]

This template generates a Cirrus search url that returns pages containing a template name embedded in Html hidden text delimiters, i.e., the page must contain the following hidden text label:

  • <!-- Template:Foo bar -->

where the template being searched for is 'Foo bar' (if param 1 = Foo bar, otherwise, {{PAGENAME}}). The Html begin and end delimiters must be exactly as shown, and there may be any number of blank spaces (zero or more) between the delimiter and the Template name, front and back. There may be two or three hyphens in the delimiters. There may not be any other content between the delimiters.

Performance and timeout

[edit source]

This template uses Cirrus regular expression search, which can be slow for queries that return a great many results, and may time out after 20 seconds, usually with a partial result set returned. If the query times out or doesn't produce as many results as you believe it should, you may be able to produce more results by trying again at a time when the server is under less load. Another way to avoid a timeout in some cases, is by using the |year=parameter, which will reduce the number of results. Some sample timings: {{uw-v4}}: 238,144 results in approx. 5 seconds; {{uw-v3}}: 425,295 = ~7"; {{uw-v2}}: 808,617 = ~10"; {{uw-v1}}: 2,490,016 = ~17" (timed out; results incomplete).

False positives and negatives

[edit source]

Sometimes, the hidden tag does not match the template name. (This sometimes occurs after page moves, or copy/pasting when creating a new template.) You may be able to remedy this by using positional param 1 to specify the hidden tag. If the page was moved at some point and the tag was changed, you may end up with some substed pages with one tag, some with another; a workaround in this case is to use the template twice: one of them will need to use param 1.

A more complex case occurs when someone uses the Cirrus link to search for substitutions of a template copied from another without a tag change; this will turn up instances of the copied template as a false positive, skewing the count of actual substitutions of the older one.[a] The flip side of that is underreporting of substed templates who have or used to have the wrong tag. This includes misspellings, such as "Teahouse_AfC_invitaiton" [sic] which can be found by using param 1 set to the misspelled token: {{fsubst|Teahouse_AfC_invitaiton}}, which gives 38,000 results for decade-old substitutions, until the spelling of the tag was corrected at some point. (But those 38,000 misspelled results were substed, so they are never going away.)

Year search issues

[edit source]

Using param |year= successfully depends on the appearance of the year as part of a signature which almost invariably appears after the template. This template cannot find substed templates that contain no signature, or which contain a signature without a timestamp. Because pages in subject namespaces generally contain no signature, it usually does not make sense to pair the use of parameter |year= with parameter |sns= when specifying any subject namespace, with the exception of noticeboards and other boards like WP:Xfd in project space which typically do contain dated signatures.

The search string used to find templates substed in a given year depends on the hidden template name string at the end of the template, and on a signature containing the date following it, in that order, with no intervening newline. A very few templates, such as {{Notified}}, have the two elements but in the reverse order, with the timestamped signature first and the hidden template id afterward. Such templates cannot be found by this template, but they are few.


  1. ^ This is the case for example with templates {{Welcome graphical}} and {{WelcomeIPh}}, both of which had the token copied from {{Welcomeg}} until 7 Sept 2025, when they were fixed. Substitutions previous to that date will show up (forever) in the search results linked from the doc page of Template:Welcomeg. Any results shown for those two will only reflect substitutions after that date.

See also

[edit source]