Help:Link/ru
Гиперссылки дают пользователям возможность перемещаться между страницами. Для просмотра базовой информации по вики-форматированию смотрите Помощь:Редактирование.
В MediaWiki нет возможности создавать гиперссылки при помощи HTML. Вместо этого есть три основных вида гиперссылок, каждый со своим CSS-форматированием: вики-ссылки (wikilinks), интервики-ссылки (interwiki links, ссылки между различными вики-проектами) и внешние ссылки. Кроме собственно функции связывания, каждый из видов ссылок обеспечивает дополнительный функционал, специфичный для вики-движков, например, определение битых ссылок (ссылок на несуществующие страницы) для вики-ссылок и автоматическая нумерация внешних ссылок, когда они используются в сносках.
Вики-ссылки[edit]
Вики-ссылка - это внутренняя ссылка на другую страницу или секцию страницы в пределах одной wiki. MediaWiki автоматически проверяет, существует ли целевая станица, на которую ведёт вики-ссылка ("определение существования"). Если страница не существует, то ссылка ведет к секции редактирования, и ей присваивается класс "новая". Такие вики-ссылки называются "красными ссылками", т.к. они выделяются красным цветом шрифта в таблице стилей по умолчанию. "Красные ссылки" полезны для определения текущего статуса страницы (создана или не создана), создания ссылок на планируемые страницы и для поощрения создания новых страниц другими участниками. С помощью пункта меню "Ссылки сюда", применённого к несуществующий странице, можно также увидеть непрямые ссылки на другие страницы, где присутствует та же самая красная ссылка.
В пространстве имен MediaWiki ссылка на несуществующую страницу для существующего системного сообщения учитывается как ссылка на существующую страницу.
Синтаксис[edit]
MediaWiki определяет вики-ссылку по завершённому набору парных квадратных скобок '[[ ]]'. Целевая страница ссылки — последовательность символов, расположенная между первой парой скобок и вертикальной чертой-разделителем (т.н. пайп, pipe — '|') или закрывающей парой скобок ']]'. Целью ссылки может быть другая вики-страница, раздел на той же странице, на которой расположена ссылка, или раздел на другой вики-странице.
- Межстраничные ссылка: ссылка вида
[[имя_страницы]]
, ведет на страницу с именем "имя_страницы"
- Внутристраничная ссылка: ссылка вида
[[#имя_ссылки]]
ведёт на первую секцию текущей страницы, которая имеет заголовок (или якорь), с именем "имя_ссылки".
- Межстраничная "интра" ссылка: ссылка вида
[[имя_страницы#имя_ссылки]]
ведёт на соответствующую секцию страницы с именем "имя_страницы", см. ссылки на секции.
Синтаксис вики-ссылок также включает различные опции форматирования, определяющие внешний вид ссылок.
Основы синтаксиса вики-ссылок | ||||
---|---|---|---|---|
Код | → | Результат | Цель | Описание |
[[a]] | → | a | a | Простейшая wiki-ссылка |
[[a b]] | → | a b | a b | Несколько слов |
[[a b|c d]] | → | c d | a b | Ссылка указывает на 'a b', но отображается как 'c d' * |
[[a b]]c | → | a bc | a b | Наименование ссылки совпадает с целью ссылки, к последнему слову в наименовании добавлено окончание |
<nowiki>[[a]]</nowiki> | → | [[a]] | Ø | Текст отображается как есть, без свойств ссылки |
введено: [[a (b)|]], преобразовано в: [[a (b)|a]] |
→ | a | a (b) | Вертикальная черта-разделитель '|' непосредственно перед закрывающей парой скобок ']]' создаёт ссылку, в наименовании которой скрыт текст, находящийся в круглых скобках *,*** |
введено: [[a, b|]], преобразовано в: [[a, b|a]] |
→ | a | a, b | Вертикальная черта-разделитель '|' непосредственно перед закрывающей парой скобок ']]' создаёт ссылку, в наименовании которой скрыта запятая и всё, что идёт после неё *,*** |
введено: [[w:a|]], преобразовано в: [[w:a|a]] |
→ | a | w:a | Вертикальная черта-разделитель '|' непосредственно перед закрывающей парой скобок ']]' создаёт ссылку, в наименовании которой скрыта первый префикс ссылки *,**,*** |
введено: [[w:a (b)|]], преобразовано в: [[w:a (b)|a]] |
→ | a | w:a (b) | Вертикальная черта-разделитель '|' непосредственно перед закрывающей парой скобок ']]' создаёт ссылку, в наименовании которой скрыт и первый префикс ссылки, и текст в скобках *,*** |
entered: [[mediawiki:1movedto2|]] | → | mediawiki:1movedto2 | Mediawiki:1movedto2 | |
entered: [[mediawiki:1movedto2|]] | → | mediawiki:1movedto3 | Mediawiki:1movedto2 |
Wikilink Tricks & Demos | ||||
---|---|---|---|---|
Код | → | Результат | Цель | Описание |
[[a|b|c]] | → | b|c | a | Вики-разметка распознает второй канал '|', как обычный текст * |
[[a|b]]c | → | bc | a | 'c' is appended to the end of the link text, targets 'a' -- (Good for adding a plural-'s') * |
a[[b]] | → | ab | b | 'a' непосредственно предшествует тексту ссылки, но не входит в него |
[[a]]<nowiki>b</nowiki> | → | ab | a | 'b' следует непосредственно за текстом ссылки, но не входит в него |
[[a]]''b'' | → | ab | a | Using double apostrophes '' around 'b' to make it italicized excludes it from the link text |
[[a]]'''b''' | → | ab | a | Using triple apostrophes ''' around 'b' to make it bold excludes it from the link text |
[[a|b]]c<nowiki>d</nowiki> | → | bcd | a | Translates like [[a|bc]]<nowiki>d</nowiki> * |
[[a]][[b]] | → | ab | a , b | Two links next to each other, looks like ab when not hovered over with a cursor |
* Англоязычный термин для ссылок, оформленных таким образом, через текст ссылки в качестве параметра — piped links.
** Вне зависимости от вида префикса — ведёт он в другую вики (интервики), в другое пространство имён, или просто текст ссылки содержит двоеточие.
*** Не работает с внутристраничными #-викиссылками (intra-page): отображает [[#xxxx|]] как текст.
Отметим что тот же самый синтаксис вики-ссылок действует при оформлении ссылок на изображения, категории, а также для создания межязыковых ссылок (т.н. интервики-ссылок). Попытки на что-то сослаться будут, как правило, заключаться размещении на странице изображений, добавлении страниц в категории и создании межязыковых ссылок в конце страницы. Такие ссылки могут быть предварены префиксом в виде двоеточия, которое позволяет реализовать особый синтаксис. Например, [[:Category:Help]]
, [[:fr:Help:Link]]
, и [[:File:Mediawiki.png]]
.
В случае локальной ссылки на изображение, не существующее в данном проекте, но присутствующее на Викискладе, динамически подгружается страница описания изображения с Викисклада; при этом такая страница учитывается как существующая для ссылок со страниц, например File:Cow-on pole, with horns.jpeg, но не для ссылок в комментариях к правкам и в системных журналах.
Существующие на страницах внутренние ссылки, ведущие на существующую или несуществующую страницу, записываются в общую таблицу ссылок.
The maximum link length (before optional bar character) is 255 bytes, after expansion of .. and / and UTF-8 encoding.
Ссылки на статьи-заготовки[edit]
Если целевая страница существует, находится в основном пространстве имён, не является перенаправлением и число байт вики-текста в ней меньше, чем заданное в персональных настройках «пороговое значение для статей-заготовок» (threshold for stub display) — такой вики-ссылке будет присвоен класс 'stub' (заготовка, черновик).
Это позволяет участникам немедленно идентифицировать ссылки на очень короткие страницы (которые, возможно, нуждаются в расширении) а также ссылки на страницы разрешения неоднозначностей. В качестве альтернативы, участник может задать для себя это пороговое значение очень высоким, чтобы достичь что-либо из следующего:
- Определение ссылок на очень большие страницы. Между тем, критерием служит размер вики-текста; возможное включение шаблонов и изображений может делать обрабатываемую станицу большой, даже если количество вики-текста невелико.
- Определение того, ведёт ли ссылка на основное пространство имён. Однако, при этом не будут учтены перенаправления на основное пространство имён (даже если само перенаправление находится в основном пространстве имён).
- Идентификация ссылок на перенаправления, в рамках работ по подчистке двойных перенаправлений.
Между тем, ссылка на разделы таких статей-заготовок не работает. Хотя это и незначительная особенность, она может стать причиной возникновения проблем у тех участников, которые устанавливают себе очень высокий порог определения статей-заготовок.
Интервики-ссылки[edit]
Интервики-ссылка ссылается на страницу другого веб-сайта. В отличии от name suggests (?), целевому сайту нет необходимости быть вики-сайтом, но он должен быть указан в интервики-карте исходной вики. Этим ссылкам присваивается CSS-класс "extiw". Такие ссылки имеют тот же вид, что и вышеописанные вики-ссылки, но содержат префикс, по которому определяется целевой сайт. Например, у проектов Викимедиа (исключая Википедию) и множества других вики-сайтов ссылка вида [[wikipedia:Main Page]]
ссылается на заглавную страницу английской Википедии. Префикс может быть скрыт с помощью синтаксиса, использующего тот же символ вертикальной черты, как в случае с вики-ссылками.
Интервики-ссылки могут также ссылаться на разделы и другие якоря, см. описание ссылок на разделы.
Интервики на тот же проект[edit]
Хотя интервики-ссылки и могут быть использованы для указания страницы того же самого вики-проекта, такое обычно не рекомендуется. MediaWiki не определяет, существует ли целевая страница в существующем списке интервики-ссылок, так что здесь нет специального форматирования и ссылка всегда выглядит так, как будто целевая страница существует. В дальнейшем MediaWiki не проверяет, не ссылается ли страница сама на себя. Вики-ссылка на ту же страницу, на которой она размещена, выделяется (как Help:Link/ru), тогда как аналогичная интервики-ссылка ссылка не выделяется (см. m:Help:Link/ru).
ЗА:
- При копировании вики-текста в родственный проект, ссылка может продолжать указывать на целевую страницу. Иногда для данной цели необходимы два префикса, например w:de:a.
ПРОТИВ:
- Ссылка имеет нестандартный вид
- Нет проверки существования целевой страницы
Внешние ссылки[edit]
External links use absolute URLs to link directly to any webpage. These links have the associated CSS class "external". External links are in the form [http://www.example.org link name]
(resulting in link name), with the link name separated from the URL by a space. Links without link names will be automatically numbered: [http://www.example.org]
becomes [1]. Links with no square brackets will be displayed in their entirety: http://www.example.org.
To show a URL without link use e.g. <nowiki>http://www.example.org</nowiki>
giving http://www.example.org.
Unlike in the case of internal links, characters immediately after the closing bracket are not added to the link label: [http://www.example.org a]s gives as.
See URLs in external links for more detailed information.
Ссылки на e-mail[edit]
Links to an E-mail address work the same way that external links do, except they require the prefix mailto:
. E-mail links are in the form of [mailto:anyone@example.org address name]
(resulting in address name), with the link name separated from the address by a space. Addresses without names will automatically be numbered: [mailto:anyone@example.org]
becomes [2]. Addresses without square brackets will not be rendered as link, e.g. anyone@example.com. It's possible to make CC with [mailto:anyone@example.org?cc=anyone2@example.org address name]
(resulting in address name).
Ссылки на специальные страницы того же проекта[edit]
External links support various special optional URL parameters in their linking-code. These allow links directly to the edit history of a page, to a page in edit view, a diff of two versions, et cetera. They can also be used to create a navigational image.
For portability, use "fullurl" where the URL should depend on the project.
Иконки после ссылки[edit]
MonoBook skin produces an arrow icon after every external link. This can be suppressed with class="plainlinks":
With some special code on MediaWiki:Common.css such as on m:MediaWiki:Common.css, external links to PDF files have their own icon . On this site with your current settings http://a.pdf gives http://a.pdf .
Пропуск номера ссылки[edit]
To skip a number in the automatically numbered external links (for whatever reason), use e.g. <span style="display:none">[http://a]</span>: [3][5].
Note that a false condition of a ParserFunction, or a template like Template:x0 [ talk edit history links ] does not work, because counting the links is done after expansion of templates and parser functions.
Поиск по внешним ссылкам[edit]
Special:Linksearch (an extension installed on Wikimedia wikis, [6]) finds all pages linking to a given URL. Using the externallinks table it provides for a given external link pattern a list of source page names on the wiki concerned (linked) with for each the full link target (also as a link). One can either search all namespaces or a selected one. A leading wildcard * can be used to search links to a whole top-level domain (e.g. [7]), or a second-level domain (e.g. [8]), etc. In the case that a full domain name is specified, one can additionally specify the rest of the URL, or the first part of that (a wildcard at the end is implied), e.g. [9].
Remarks:
- Do not put "http://".
- The colon in the URL may cause the program return no results.
- A MediaWiki page name in a URL has underscores instead of spaces. Also the URL specified in Linksearch requires writing underscores.
- Even if multiple URLs lead to the same target, with regard to capitalisation, multiple underscores, and using "index.php" or not, Linksearch is case-sensitive and also does not find alternatively written URLs. Therefore, when creating an external link, for optimal use of Linksearch, use a canonical form for the URL. In particular, if after following a link the address bar shows a modified URL, change the URL in the link to that.
- The list is Help:Alphabetic_order#alphabetic in the URL. Note that an underscore, unlike a blank space, is alphabetically positioned between "Z" and "a".
Обратные ссылки[edit]
Commonly, a link to a normal page on the same project is in internal link style. An advantage is the existence detection. Also, if some links are in internal and some in external link style, we need both "What links here" and Linksearch for finding all backlinks. However, especially for a link to a section or explicitly-set anchor, one could put an internal link and also, with CSS style "display=none", an external link, to provide backlinks.
External link style is also superior to interwiki link style. The URL specified for Linksearch can even contain an anchor (see below), or the first part of an anchor. Therefore Linksearch can find backlinks of sections and explicit anchors. In this regard external links are even superior to internal links. We can combine the advantages of internal and external link style by putting both, but hiding the external links: <span style="display:none">http://...</span>
Якоря[edit]
Ссылки на якоря[edit]
Links of the form [[#anchor_name]]
will link to the first anchor on the page matching that "anchor_name", usually the first identical section heading.
An #anchor_name can also be appended to the page name in any type of link, thus linking to the first identical section heading (or anchor) of the named page:
[[Help:Editing#Links]], [[m:Help:Editing#Links]],
http://meta.wikimedia.org/wiki/Help:Editing#Links
Якоря, расставляемые автоматически[edit]
Section headings automatically act as anchors, with the heading text as the "anchor_name". In the case of multiple sections with identical headings, the anchor name of each has "_2", "_3", etc. appended, starting from the second occurrence.
The anchor #toc links to the table of content of the page, unless there is a section titled "toc".
Якоря, расставляемые вручную[edit]
Manually-set anchors are useful for linking to "unlinkable" things like a table (title or cell), a section of plain text, etc. For example, in the Wikilink Tricks & Demos table above, though the "Wikilink Tricks & Demos" title-text appears like a (minor) heading, it is not, and the otherwise perfectly normal wikilink [[#Wikilink Tricks & Demos]]
will not work.
There are a number of ways to set an anchor at an arbitrary position:
- On some wikis, a template called "anchor" exists, e.g. Template:anchor [ talk edit history links ] and w:Template:anchor [ talk edit history links ], providing a simple, standardized method for that wiki.
- Generic anchor:
<span id="anchor_name">some text</span>
. For a hidden anchor, omit the text.
- Manual HTML headings (discouraged):
<h2>How to Edit</h2>
. Text is anchor_name.
- In some cases, inserting an HTML-like ID attribute into an (existing) Wiki-element. For example, from the Wikilink Tricks & Demos
table above:
!colspan="5" align="left" id="Wiki-link Tricks"|Wikilink Tricks & Demos
- The reserved name
[[#top]]
always links to the top of a page.
See also Help:Section#Section_linking.
Якоря для поиска по внешним ссылкам[edit]
As mentioned above, if external link style is used, e.g. [10], we can use Special:Linksearch: [11].
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".
«Каталожные» якоря[edit]
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 [12]), with leading zeros (see also [13]). 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 headings, explicitly put anchors 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 headings that cannot be used as anchors.
Якоря во внешних ссылках (anchorencode)[edit]
In an external link, an anchor can be created conveniently with the parser function anchorencode, for example, "{{anchorencode:Anchors in external links (anchorencode)}}"
→ "Anchors_in_external_links_(anchorencode)" [14], which can be used to form the link //meta.wikimedia.org/wiki/Link/ru#Anchors_in_external_links_(anchorencode)
Подстраницы[edit]
MediaWiki has a subpage feature, although activation depends on project and namespace. If activated, the following applies (if not, "A/b" is just a page with that name).
A tree structure of pages is established by using forward slashes in pagenames: A/b is a child of A, hence A is a parent of A/b; also A/b/c is a child of A/b; while A/a, A/b, and A/c are siblings.
At the top of the subpage body links to all ancestor pages are shown automatically, without any corresponding wikitext. The links show up even if the parent page does not exist, but the sequence of ancestors stops before any non-existing ancestor page (e.g., if the grandparent page does not exist, the parent page is not shown either). Like most letters of a page name, the first letter after the slash is case-sensitive; "/subpage" and "/Subpage" are different pages.
What links here and Related changes ignore these automatic links.
In the namespace where the subpage feature is activated, any slash in a page name causes a subpage structure, even if unintended.
A list of subpages can be obtained using Special:PrefixIndex.
Переменные[edit]
On page A:B/c/d, where A is a namespace with the subpage feature enabled, {{BASEPAGENAME}} gives B/c and {{SUBPAGENAME}} gives d
Относительные ссылки[edit]
Inside a subpage hierarchy the following relative links can be used:
- [[../]] links to the parent of the current subpage, e.g., on A/b it links to A, on A/b/c it links to A/b.
- [[../../]] links to the grandparent of the current subpage, e.g., on A/b/c it links to A.
- [[../s]] links to a sibling of the current subpage, e.g., on A/b, it links to A/s.
- [[../../s]] links to an "uncle" of the current subpage, e.g., on A/b/c, it links to A/s.
- [[/s]] links to a subpage, e.g. on A it is the same as [[A/s]]. Because of this, linking from a namespace where the subpage feature is enabled to a page in the main namespace with a name starting with "/", requires a workaround: put a colon before the pagename.
Linking to an anchor of an ancestor does not work; attempting that gives a link to a page with the name consisting of the name of the ancestor followed by "/".
Relative links still work if all pages of a tree are renamed according a name change of the root, including making it a child of a new root.
See also w:Wikipedia:Subpages, and the example pages m:Link/a/b and m:Help:Link/a/b. The subpage feature works in both namespaces.
Активация подстраниц[edit]
Wikipedia has this feature activated in all talk namespaces and the user and project namespace. The Meta-Wiki also has it in the main namespace. The default is set in DefaultSettings.php[15]. As of revision 1.21, the following namespaces have it activated by default: Special, Main talk, User and User_talk, Meta_talk, and Image_talk. Settings per project are changed in LocalSettings.php[16].
See also mw:Manual:$wgNamespacesWithSubpages .
Личное пространство участника[edit]
Subpages of a user page ([[User:Username/Subpage]]
) are considered to be in that user's "user space".
Преобразование символов[edit]
In accordance with the rules explained in Help:Page name, conversions are automatically made to non-literal characters in wiki and interwiki links. For example, "[[Help:Page%20name]]
" becomes "Help:Page name". However, the opposite is true for external links; literal characters are converted into non-literal characters. For example, most browsers will convert ".../wiki/!" to ".../wiki/%21".
A code like %70 in a redirect disables it, although the link works from the redirect page. For a redirect that works, the redirect page shows the canonical form of the target, unlike its preview page, which renders the link in the usual way.
Разное[edit]
Дополнительное форматирование ссылок[edit]
- Related changes
- Backlinks, Linksearch
- Date formatting
- Using a space after the pipe syntax ([[main Page| ]]) produces (perhaps depending on the browser) a space only, not a link (" "), but it is treated as a link for the "what links here" feature.
Всплывающие подсказки на ссылках[edit]
On some browsers, holding the cursor over a link will show a hover box ("tooltip") containing the text of the link's HTML title attribute. MediaWiki sets this to the target page name (without the possible section indication) if it's a wikilink (the message with id 'red-link-title' (talk) if the page does not exist), the page name with prefix if it's an interwiki link, and the URL if it's an external link.
This can be switched off in the user preferences. The browser may also show similar info, but with the possible section indication, in the status bar.
For these effects a piped link is useful even if it not followed to the target; for example, for displaying the meaning of an acronym (e.g. NPOV) or any other remark. It is possible to produce a hover box without a link, see Template:H:title [ talk edit history links ]. It is also possible to change the contents of the hover box, using markup similar to [[Link title|<span title="hoverbox">Display text</span>]]
, e.g.
"[[w:foot (length)|<span title="30.48 cm">ft</span>]]"
→ "ft" [17]
Ссылки со страницы[edit]
With the Query API the links from page pagename, sorted by namespace, and for each namespace alphabetically, are given by {{SERVER}}{{SCRIPTPATH}}/query.php?what=links&titles=pagename , e.g. //meta.wikimedia.org/w/query.php?what=links&titles=Help:Link/ru .
Изображение-ссылка на страницу[edit]
It is possible to use images as links to other pages. For more information, see use an image as a link to a page.
Смотри также[edit]
- Help:Editing#Links, URLs
- Help:URL
- Help:Self link
- Help:Template#Restrictions (and the next section)
- Help:Guide for system administrators for setting up interwiki linking
- m:Parser testing/replaceInternalLinks
- m:Parser testing/replaceExternalLinks
- mw:Links table
- m:Brokenlinks table
- Red Link
- Wikipedia:Canonicalization
- Linkless
- Special:Mostlinked - shows the number of links
- Special:Lonelypages - list of pages not linked to, by any other page