menu MediaWiki帮助 链接搜索
异世界百科
导航 目录

链接搜索

Special:LinkSearch is one of the special pages. You use it to search for external links (links to other web sites) in a wiki. It displays a list of external links that match the URL you specify, showing the source page and the exact target.

The listing is of all links in all namespaces. There is no way to show external links only in articles, which is often of greatest interest as evidenced by w:Wikipedia:External links. The MediaWiki software does offer the ability to search for links only in a specific namespace, but this functionality is disabled on Wikimedia projects, due to efficiency issues. If you run your own wiki and you have miser mode disabled the namespace functionality will be available.

Patterns

The URL pattern can be:

For example: "http://*" (Special:Linksearch/http://*) or "news:*" (Special:Linksearch/news:*)
This returns all links that use the specified protocol.
For example: "*.org" (Special:Linksearch/*.org) or "ftp://*.gov.ph" (Special:Linksearch/ftp://*.gov.ph)
This returns all links pointing to the specified domain and its subdomains.

When no scheme is specified, http:// is used. Note that everything after the domain name is ignored in the pattern.

For example: "10.*" (Special:Linksearch/10.*) or "ftp://193.206.*" (Special:Linksearch/ftp://193.206.*)
The default scheme is again "http://".

Everything after the ip address in the query pattern is ignored. Wildcards in IPv6 addresses are currently not supported.

Examples:
All links starting with the specified pattern will be returned.

Remarks:

The domain name part is not case sensitive, meaning a search for https://www.mediawiki.org/ returns the same results as a search for http://www.MEDIAWIKI.ORG/.

Note that an underscore, unlike a blank space, is alphabetically positioned between "Z" and "a".

Linksearch and sections

For links in external link style, Linksearch provides backlinks of sections, which "Special:Whatlinkshere" does not for links in internal link style. For links in interwiki link style there is no backlink feature at all.

On the other hand, links in internal link style provide existence detection. Also each of the three styles can have a different look, depending on CSS.

Therefore it is useful to combine the advantages of various link styles adding "hidden external links" to internal section links and to all interwiki links, except those for which the interlanguage link feature applies. This is done by adding <span style="display:none">http://...</span>; this can conveniently be done with a template, see below. Although no actual link is added (which would be superfluous because we have already an internal or interwiki link), it is recorded as external link, and therefore Linksearch can find it.

Since Linksearch allows specifying the first part of an anchor, it is useful, if anchor names are numerical or have a numerical end, to use leading zeros. Otherwise, when searching for links to e.g. "1", we also get links to "10", etc. This is e.g. applied in w:Portal:Current events/DateHeader2. More generally, if there are anchors "a" and "ab", it may or may not be desired that a search for links to "a" also gives links to "ab"; if not, use an anchor "_a".

Also, if anchor names have multiple components, it is useful to put the most significant component first, e.g. if anchors indicate months or dates, we could have the format YYYY-MM, or YYYY-MM-DD, or in a year page MM-DD (see also Big endian forms, starting with the year), with leading zeros (see also Link to date content other than required for autoformatting). This applies also for page names, but since these are highly visible, as opposed to anchors, other considerations play a role too. In the case of sections, if for link targets another naming scheme is desired than for display of section headers, anchorscan be put explicitly instead of using section names. This is applied in w:Portal:Current events/DateHeader2, where the use in links of the names of explicitly put anchors is enforced by using pseudo sections, with displayed headers that cannot be used as anchors.

In the case of multiple sections with the same name, the HTML produced has a HTML ID that is the section name, with, from the second occurrence, "_2", "_3", etc. appended. This does not apply when other anchors are used.

For new links to the same wiki the feature has been abolished in 2009, see r53104.

Consider this link:

Try whether it is found:

If you want to find all mailto: links to a specific mail host, you can omit the user part and @ sign. For example Special:LinkSearch/mailto:gmail.com.

Machine/programmatic access via API

参见