Template:Links to/doc

Links to lists all pages that link to a section, and shows a snippet from each page, with the link highlighted. It uses the linksto search parameter to find the pages, and from that a regexp search to find the section's incoming links. (Note that the input to links to is a section, while the input to the search parameter linksto is a fullpagename.)

Purpose
Use links to to help decide about changing or removing section headings, anchors, or "span id=" (HTML) tags. This template lists all the wikilinks to a section that are found in the wikitext as: These are all the usual-style wikilinks, and the search links produced by this template are definitive concerning the sections of most pages.
 * Manage anchors. Assess and delete excess anchors. Move and replace anchors.
 * Manage section headings. Delete section headings. Rename section headings.
 * 1) [ [ fullpagename#section ]]
 * 2) { { section link | section}}
 * 3) { { slink|section}}

While editing a section, you decide to rename its heading. Or you want to restructure an article. But it might break a link. And you're not sure about adding anchors. Using these three tools, the incoming wikilinks to a section can be known.
 * "What links here" does not report links by section name.
 * This template, links to, reports sections but does not report redirects.
 * "Show redirects only" does report redirects to sections names. (It's on the What links here page).

Usage
Work from the edit page — going from it and back to it — while finding all links and redirects. When entering a { {links to|section}} copy any section name exactly as it appears in the wikitext: The spacing outside the name is not important, but the markup and spacing inside the name is important. The most common mistake is wrong capitalization.
 * { {links to|section heading}} or
 * { {links to|anchor}} or
 * { {links to|span id}}

Should you change or removed a section name, then for each incoming wikilink or redirect it had, you must edit that page, even if it is a user page. Use an edit summary like "fixing changed section name".

Links
Links. Taken altogether, the search links generated by this template will list all wikilinks to a section name of a page name. The results do not overlap and are guaranteed links to that section.
 * #Links·Finds  used in wikilinks (and URL-style links).
 * &sect;Links·Finds . (uncommon)

Redirects
Redirects. Use the "Tool" What links here. (Its on every page and every edit page.) Once there, immediately activate the "external tool" Show redirects only. If your section name is shown, your redirects are reported. Just find the wikilinks to them using What links here, and you're done. If your section is not shown in the report, no redirect at all links to your section.

These normally report zero results (or fewer than ten).

Basic

 * { { links to | section }}

Links to creates a pink box with search links inside: one to find wikilinks, one to find templates (Section link).


 * 1) On an edit page enter a { {links to}}.
 * 2) Preview the edit. A pink box appears with search links inside.
 * 3) Visit each of them while learning how to proceed.
 * 4) Go back to your edit page.
 * 5) Visit the redirects report.
 * 6) Go back to your edit page and proceed.

Advanced

 * { { links to | section | fullpagename }}
 * { { links to | section | fullpagename | namespace }}

Links to outputs a single line starting with the fullpagename, and followed by the search links. This style is fit for collaboration or storage for wikiprojects.

Just add the fullpagename of the page of interest in parameter two. (The { {FULLPAGENAME}}, before DISPLAYTITLE or the like may have applied.)

To limit search results to a namespace instead of all namespaces, use parameter three. This is necessary for a highly linked-to page like the Manual of Style (over a million links to it). This is useful to try when a search takes around twenty seconds and returns with zero results. (Search silently fails, with no indication of an HTML timeout.)

Parameters
Spacing does not matter around the input.

{ { links to | 1st | 2nd | 3rd }}

1st Section. Case sensitive. Matches wikitext character-wise.

2nd Fullpagename. Case sensitive. First letter capitalized.

3rd namespace. Defaults to all. Accepts aliases.

Examples
Reordering. If you used natural instead of most-requested order, you can number them. What you type:

What you get: