This page is a translated version of the page Help:Links and the translation is 88% complete.
Outdated translations are marked like this.
PD Nota: Ao editar esta página, você concorda em publicar a sua contribuição no âmbito da licença CC0. Veja as páginas de ajuda do domínio público para mais informações. PD

Existem cinco tipos de links de hipertexto no MediaWiki:

  1. links internos para outras páginas no wiki (também conhecido como "wikilinks")
  2. links externos para outros websites
  3. links externos para páginas internas da mesma wiki
  4. links interwiki para outros sites usando termos registrados no wiki com antecedência
  5. links interlínguas para outros sites registrados como versões da wiki de outros idiomas

Note, por favor, que esta lista não inclui os links para categorias nem os links para arquivos, que são usados, respectivamente, para colocar as páginas em categorias e para apresentar imagens ou outros arquivos de mídia.

Links internos

Para criar um link interno para uma página na mesma wiki (um "wikilink"), use dois colchetes e o "wiki markup", "[[desse jeito]]". Quando você salvar ou pré-visualizar suas alterações, verá um link que pode direcionar para a página desejada. Se a página existir o hiperlink ficará na cor azul (como a palavra "criar" na primeira frase do parágrafo); se a página não existir, o hiperlink aparecerá em vermelho (então a hiperligação "[[desse jeito]]" é mostrada desse jeito). Lembrando que as cores podem ser diferentes se o esquema de cores da wiki foi alterado da configuração padrão. Note that the colors could be different if the color scheme of the wiki has been changed from the default. Ao clicar em um "link vermelho" você será direcionado para uma página inexistente (indiferente se for mesmo vermelha ou não) que habilitará ao usuário criar a página.

Para destacar qualquer trecho de texto (não necessariamente o título de uma página) como um link, use uma barra vertical "|", deste jeito: [[Help:Categories|hiperlink de categoria]] fica hiperlink de categoria.

A primeira letra da página de destino normalmente não diferencia letras maiúsculas de minúsculas, a não ser que a wiki seja configurado de forma diferente), o que quer dizer que links podem ter a primeira letra maiúscula ou não (então How to contribute e How to contribute são equivalentes. Porém, no caso de qualquer letra em seguida deve ser idêntica ao nome da página alvo (então How to contribute e How To contribute "não" são equivalentes). Espaços no título da página podem ser representados como sublinhado (então How to contribute e How_to_contribute equivalem), mas geralmente evita-se usar sublinhados em links já que ficam visíveis no texto da página (embora isso possa ser evitado usando uma barra vertical "|").

Se você tentar fazer um link para o título da página que você está editando o resultado não é um hiperlink, apenas um texto destacado (por exemplo: [[Help:Links/pt-br]] fica: Help:Links/pt-br). Se você está tentando criar um wikilink para a página atual, você provavelmente irá querer que o link direcione para uma "sessão" específica ou para uma "âncora" na página; veja exemplos abaixo:

MediaWiki usa a Tabela de pagelinks para manter controle de wikilinks internos

Nome/Descrição Sintaxe Resultado
Link interno
[[Main Page]]

[[Help:Contents]]

[[Extension:DynamicPageList (Wikimedia)]]

Main Page

Help:Contents

Extension:DynamicPageList (Wikimedia)

Link piped
[[Help:Editing pages|editing help]]

Links para uma seção/âncora na página de destino.

[[Help:Editing pages#Preview|previewing]]

"Piped link" para uma âncora na mesma página

[[#See also|different text]]

Veja também meta:Help:Piped link

editing help

previewing

different text

Pipe trick
[[Manual:Extensions|]]

[[User:John Doe|]]

[[Extension:DynamicPageList (Wikimedia)|]]

[[Extension:DynamicPageList (third-party)|]]

O truque do pipeline pode resultar no mesmo texto para links para páginas diferentes, como pode ser visto nos exemplos de DynamicPageList.

Extensions

John Doe

DynamicPageList

DynamicPageList

Terminações de palavras em links
[[Help]]s

[[Help]]ing

[[Help]]ers

[[Help]]almostanylettersyoulikehere

[[Help]]BUTnotalways

Segue as "regras de linktrail" localizadas por cada idioma.

Helps

Helping

Helpers

Helpalmostanylettersyoulikehere

HelpBUTnotalways

Evitando terminações de palavras em links
[[Help]]<nowiki />ful advice

[[wikipedia:GNU General Public License|GPL]]<nowiki />v3

Helpful advice

GPLv3

Link interno para uma âncora na mesma página
[[#See also]]

Âncoras são providenciadas automaticamente no cabeçalho da sessão e no topo ([[#top]]) da página.

#See also
Definindo uma âncora para links recebidos
<div id="Unique anchor name 1">optional text</div>

<span id="Unique anchor name 2">optional text</span>

Rendered block-level and inline, respectively. Isso faz com que o [[#Âncora específica nome 1]] na mesma página ou o [[Help:Links/pt-br#Âncora específica nome 1]] numa página diferente. Omita o "texto opcional" para uma âncora invisível.

Ancorando no cabeçalho de uma sessão.

==<span id="Alternate Section Title"></span>Section heading==

Ênfase no posicionamento. Esse deve ser uma tag "span", não um "div". (Essas âncoras permitem sessões serem reentituladas sem quebrar o direcionamento dos links.)

texto opcional

texto opcional

Section heading
Link para uma âncora em outra página
[[Help:Images#Supported media types for images]]
Help:Images#Supported media types for images
Link para a página de discussão da página atual
[[{{TALKPAGENAME}}|Discussion]]

Ver também Help:Magic_words#Page_names

Discussion
Link para uma subpágina
[[/example]]

Atalho para [[Help:Links/example|/example]] Ver também Help:Subpáginas .

/example
Link para uma sub-página sem a barra à esquerda
[[/example/]]

Atalho para [[Help:Links/example|example]]

example
Link para uma subpágina da página principal da página atual. Só pode ser usado em subpáginas.
[[../example2]]

Atalho para [[Help:Links/example2|example2]] se você postar o link na página [[Help:Links/example|example]].

example2
Link visível para uma página de categoria
[[:Category:Help]]

Sem a coluna principal o link não seria visível e a página seria colocada na categoria; isso é um erro bem comum. Veja também Help:Categorias .

Category:Help
Link visível para uma imagem ou um arquivo de mídia.

File:Example.jpg

file label

Media:Example.jpg

file label

Link para uma página específica para cada leitor (página de usuário, etc)
[[Special:MyPage]]

[[Special:MyTalk]]

[[Special:Preferences]]

Special:MyPage

Special:MyTalk

Special:Preferences

Link interno para uma revisão específica
[[Special:PermanentLink/2393992]]

Números de revisão podem ser encontrados ao edit history de cada página. (É bem comum ver links para revisões específicas implemtendas como links externos por ser mais fácil de copiar e colar uma URL)

Special:PermanentLink/2393992
Link interno para um "diff"
[[Special:Diff/2393992]]

[[Special:Diff/2390639/2393992]]

O padrão (no primeiro exemplo acima) é mostrar as mudanças da revisão anterior. Veja também os comentários no item anterior.

Special:Diff/2393992

Special:Diff/2390639/2393992

Redirecionamento
#REDIRECT [[Main Page]]

Deveria ser a primeira "e única" linha na página. Ver também Help:Redirecionamentos .

  Main Page

Links externos

Para criar um link externo, normalmente para um site diferente, coloque a URL seguida por um espaço e o nome da página que você deseja linkar entre colchetes [ ]. Quando você visualizar alterações ou salvar a página, você verá o novo link ligeiramente diferente do wikilink interno. Pode ser de uma cor diferente e/ou seguido por uma seta para indicar que o link pode levar a outro site.

Descrição Você digita O resultado é
Link externo com texto especificado do link
[https://mediawiki.org MediaWiki]
MediaWiki
Link externo numerado
[https://mediawiki.org]

Isso é o que acontece se você omite o texto do link. Vários links desse tipo na mesma página são numerados sequencialmente. Multiple links of this type on the same page are numbered sequentially.

[1]
Link externo simples
https://mediawiki.org

URLs começando com "http://" e "https://" são automaticamente ligados, mesmo sem o uso de colchetes.

https://mediawiki.org
Evitando URL's linkadas automaticamente.
<nowiki>https://mediawiki.org</nowiki>
https://mediawiki.org
Link externo de Protocolo-relacionado
[//en.wikipedia.org Wikipedia]

[//en.wikipedia.org //en.wikipedia.org]

O link será HTTP ou HTTPS dependendo do protocolo da página em que cada usuário está (que pode ser diferente entre os usuários) Isso só é permitido dentro dos colchetes [ ] Usando //en.wikipedia.org por se só "não" resulta em um link.

Wikipedia

//en.wikipedia.org

Link externo para o servidor atual
https://{{SERVERNAME}}/pagename
https://www.mediawiki.org/pagename
Link externo para outro host passando o nome da página
https://google.com/search?q={{PAGENAMEE}}

Ver também: nomes de páginas codificadas em URL, Manual:PAGENAMEE encoding

https://google.com/search?q=Links
Link de e-mail
[mailto:info@example.org email me]
email me
Link de e-mail nomeado com linha de assunto e corpo
[mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info]
info
URI personalizada
[skype:echo123 call me]

Qualquer URI que você desejar adicionar deve primeiro ser declarado através de $wgUrlProtocols . (Este exemplo não está habilitado no mediawiki.org)

[skype:echo123 call me]

Using email links

Email links use mailto: before the address. They're written like this: [mailto:anyone@example.org address name] (resulting in address name). If there's no name, the address is automatically numbered, like this: [mailto:anyone@example.org] becomes [2]. Addresses without square brackets won't be linked, e.g., anyone@example.com. You can also add a CC using [mailto:anyone@example.org?cc=anyone2@example.org address name] (resulting in address name). To add a subject, use [mailto:me@me.com?subject=Me] "

Links externos para páginas internas

Para adicionar um link para uma página no mesmo wiki usando parâmetros de consulta URL, pode ser necessário usar sintaxe de link externo.

Descrição Você digita O resultado é
Link externo para a página de edição da página atual
[https://www.mediawiki.org/w/index.php?title=Help:Links&action=edit Edit this page]

[{{fullurl:{{FULLPAGENAME}}|action=edit}} Edit this page]

Veja também Help:Magic_words#URL_data e #External links acima.

Edit this page

Edit this page

Link externo para a página de edição da página atual e estilizado para se parecer com uma ligação interna
<span class="plainlinks">[https://www.mediawiki.org/w/index.php?title=Help:Links&action=edit Edit this page]</span>

A classe plainlinks pode ser usada nos casos em que você quer que um link externo se pareça com um interno, suprimindo o ícone que normalmente aparece depois.

Edit this page

The arrow icon

Some skins add an arrow icon after each external link by default. However, this can be avoided by using class="plainlinks". For instance:

  • [http://a a] gives a
  • <span class="plainlinks">[http://a a]</span> gives a

Using Linksearch

Special:Linksearch is a built-in tool that helps find pages linked to a specific URL. By using the externallinks table, it generates a comprehensive list of page names where the link originates, along with the complete target link for each source page. You can search in all namespaces or just one. It supports wildcard (*) use, so you can search by top-level domain (e.g. [3]), second-level domain (e.g. [4]), etc. or refine your search by specifying parts of the URL e.g. [5].

Notes:

  • Avoid including "http://".
  • The program might not return any results if there is a colon in the URL.
  • MediaWiki page names in URLs should have underscores instead of spaces. The Linksearch function also requires underscores in URLs.
  • Linksearch is sensitive to capitalization, multiple underscores, and the use of "index.php". It may not find alternative URLs even if they lead to the same target. Therefore, when creating an external link, it's best to use the canonical form of the URL. If the address bar displays a modified URL after following a link, update the URL in the link accordingly for optimal use of Linksearch.
  • The list is sorted by URL, using standard page name order. Note that an underscore, unlike a blank space, is alphabetically positioned between "Z" and "a".

Using backlinks

Normally, internal links within a project are easy to spot and useful for finding related pages. But when there's a mix of internal and external links, it can be tricky to track backlinks, it necessitates the use of both "Help:What links here" and "Linksearch". However, for links to specific sections or anchors, it's possible to include both an internal link and, with CSS styling using "display=none" an external link to provide backlink.

External links are better than interwiki links. With Linksearch, you can even find backlinks to specific sections or anchors. So, combining both internal and external links while hiding the external ones "<span style="display:none">http://...</span>", gives us the best of both worlds.

Limitações

  1. External links doesn't support Word-ending links.
  2. External links doesn't count toward Special:WhatLinksHere (What links here).

Links interwiki

Links interwiki são links com marcação de link interno para outros sites (que não precisam ser wiki, apesar do nome). For example, you can link to the article https://en.wikipedia.org/wiki/Sunflower by typing [[wikipedia:Sunflower]] or, on this wiki, the shorter [[w:Sunflower]]. Both will result in a link wikipedia:Sunflower. This works because by default MediaWiki configures wikipedia: as an "interwiki prefix" that turns into https://en.wikipedia.org/wiki/ when used inside [[ ]]. (Pode não funcionar se o administrador da sua wiki mudou a configuração.) Ao contrário de links internos, links interwiki não detectam a existência de página, então um link interwiki aparecerá em azul mesmo se a página não existir na wiki remota.

Semelhante a links de páginas internas, você pode criar piped links, com rótulo de link alternativo, por exemplo, [[wikipedia:Girassol|grande flor amarela]] é o link grande flor amarela e [[wikipedia:Girassol|]] é o link Girassol.

Basicamente, links interwiki são abreviações de links externos longos comumente utilizados. Um link muito similar poderia ser criado como [http://en.wikipedia.org/wiki/Girassol grande flor amarela].

Mais detalhes em Manual:Interwiki e m:Help:Interwiki linking. Sua wiki pode ter uma página Special:Interwiki listando os prefixos interwiki que ela suporta; here is the default interwiki list. Você pode editar a $1 table de seu site. Your wiki may have a Special:Interwiki page listing the interwiki prefixes it supports; here is the default interwiki list. You can edit the interwiki table on your site.

Links entre idiomas

Se o sua wiki tiver versões em outros idiomas, você pode encontrar links interlíngua na barra lateral, logo abaixo das ferramentas numa sessão entitulada “em outros idiomas.”

Em uma marcação wiki um link entre idioma se parece muito com um link interwiki, mas funciona como um Link Categórico pois também é processado de um jeito específico. Enquanto links categóricos (normalmente) aparecem numa lista especial no final da página, links entre idiomas aparecem numa lista especial na barra lateral da página (ou em outro lugar, dependendo da configuração da wiki e do tema utilizado).

O propósito dos links entre idiomas é ligar páginas do mesmo assunto em diferentes idiomas. To create an interlanguage link, type [[language prefix:page name]] anywhere in the page (preferably at the bottom, like category links); the language prefix is the prefix specified at your wiki for the other language version (typically the ISO 639-1 language code). O link entre idiomas é não é uma via de mão dupla, o link não direciona de volta na página do outro idioma. Por isso, um link equivalente tem que ser colocado lá também. Não funciona como o "Editar links" na sessão de idiomas das versões de idioma da Wikipedia. Mas pode ser usado entre todos os espaços para nomes, incluindo 'usuário:' para direcionar para outros perfis em outros idiomas.

Se você quiser fazer um link interlíngua aparecer no conteúdo da página, em vez de na barra lateral, você pode adicionar dois pontos antes do prefixo idioma:

[[:pt:Brasil]]pt:Brasil

Quando um link é tanto interwiki quanto interlíngua, a ordem é wikipedia:pt-br:Girassol.

Para mais informação, veja m:Help:Interwiki linking#Interlanguage links.

Anchors

Linking to an anchor

Links in the format [[#anchor_name]] will direct to the first matching anchor on the page, typically corresponding to the first identical section heading.

You can add an [[#anchor_name]] to a link, directing it to the first matching section heading (or anchor) on the named page:

[[Help:Editing#Advanced editing]]

https://www.mediawiki.org/wiki/Help:Editing#Advanced_editing

Using an automatic anchor

Section headings serve as anchors, using the heading text as the anchor name. If there are multiple sections with identical headings, each subsequent occurrence is appended with "_2", "_3", etc.

The anchor #toc links to the page's table of contents, except when there's a section titled "toc."

A manual anchor

Manually-set anchors are beneficial for linking to "unlinkable" elements such as tables (titles or cells) or sections of plain text. For instance, in the External links to internal pages section above, although the column text "Description" resembles a (minor) heading, it is not.

There are several methods to set an anchor at any position:

  • The "anchor" template, if it exists on your wiki, specified as {{Anchor }}, offers a standardized method to create anchor points. Place the template where you want, using the syntax {{Anchor|Name_of_Anchor}}. For instance, {{Anchor|Description}} is placed in the "Description" column of the table below the "External links to internal pages" section. Clicking on #Description links to that anchor point created on the table. The anchor is only visible via the source code.
  • Use the generic anchor tag <span id="anchor_name">some text</span> with optional text for visible anchors. For hidden anchors, omit the text. To point to the anchor use [[#anchor_name]].
  • Avoid using manual HTML headings like <h2>Editing Instructions</h2>. This text serves as an anchor_name.
  • In certain instances, adding an ID attribute similar to HTML within a Wiki-element is necessary. Take, for instance, the table mentioned earlier, titled External links to internal pages:
border="1" class="wikitable" id="You type"
  • A top of a page can be accessed using the reserved term [[#top]].

See also Help:Section#Linking sections using an arbitrary id.

Using Linksearch anchors

As mentioned above, if external link style is used, e.g. [6], we can use Special:Linksearch: [7].

When using Linksearch, it's helpful to add leading zeros to numerical anchor names to prevent unintended matches. For example, instead of searching for "1", use "01" to avoid including "10". This practice is seen in w:Portal:Current events/DateHeader2. Similarly, if there are anchors like "a" and "ab", using "_a" can distinguish them in search results.

Anchorencode

The #anchorencode parser function encodes input to use as an anchor. For example, to external link to #Using linksearch anchors above, you would use https://www.mediawiki.org/wiki/Help:Links#{{anchorencode:Using Linksearch anchors}}, which resolves to https://www.mediawiki.org/wiki/Help:Links#Using_Linksearch_anchors

Subpage feature

MediaWiki has a subpage feature that may or may not be active depending on the project and namespace. If it's activated, the following rules apply; otherwise, "A/b" is simply a standalone page with that name.

A page's tree structure is formed using forward slashes in page names: A/b is considered a subpage of A, making A the parent of A/b; additionally, A/b/c is a subpage of A/b; meanwhile, A/a, A/b, and A/c are categorized as sibling pages.

The subpage body automatically displays links to all parent pages without needing specific wikitext. These links appear even if the parent page doesn't exist. However, if any ancestor page in the sequence is missing, the chain of links will stop before that point. Additionally, the capitalization of letters after the forward slash in the page name matters, meaning "/subpage" and "/Subpage" refer to different pages.

The functions, What links here and [Help:Related changes|]] do not consider these automatically generated links."

When the subpage feature is enabled within a namespace, any forward slash in a page's name automatically creates a subpage structure, regardless of whether it was intended or not.

You can find a list of subpages using Special:PrefixIndex.

Using variables

When utilizing the subpage feature within namespace A on page A:B/c/d, {{BASEPAGENAME}} shows B/c while {{SUBPAGENAME}} shows d.

Using relative links

Within a subpage hierarchy, you can utilize the following relative links:

  • [[../]] links to the parent page of the current subpage. For example, on page A/b, it takes you to page A, and on page A/b/c, it directs you to page A/b.
  • [[../../]] links to the grandparent page of the current subpage. For example, on page A/b/c, it points to page A.
  • [[../s]] links to a sibling page of the current subpage. For example, on page A/b, it leads to page A/s.
  • [[../../s]] links to an "uncle" page of the current subpage. For example, on page A/b/c, it points to page A/s.
  • [[/s]] links direct to a subpage. On page A, it functions similarly to [[A/s]]. However, linking from a namespace with an enabled subpage feature to a main namespace page starting with "/" requires a workaround: adding a colon before the page name.

Relative links remain functional even when all pages within a hierarchy are renamed to reflect a change in the root's name, even if the root becomes a child of a new parent. Users with the appropriate permissions, such as administrators and those with the move-subpages right, have the option to move both the main page and its subpages during a renaming process.

Learn more about subpages at w:Wikipedia:Subpages. See examples at Help:Link/example and Help:Link/example/example2

Subpage activation

This feature is only enabled in namespaces specified in the $wgNamespacesWithSubpages configuration setting, either its default namespaces, or any additional namespaces set in LocalSettings.php

Character conversion

The guidelines outlined in m:Help:Page name state that in wiki and interwiki links, conversions are made to non-literal characters automatically. For example,"[[Help:Page%20name]]" will display as "m:Help:Page name". Conversely, external links operate oppositely; literal characters are transformed into non-literal characters. For example, browsers typically convert ".../wiki/!" to ".../wiki/%21".

Applying a code like %70 to a redirect deactivates it, even though the link remains accessible from the redirect page. To ensure a successful redirect, the redirect page displays the canonical form of the target, unlike the preview page which shows the link in its regular format.

Miscellaneous

Some additional effects of links

  • Related changes
  • Backlinks, Linksearch
  • When you include a space after the pipe symbol ([[main Page| ]]), the outcome can vary depending on the browser. In some cases, it might only display a space (" "), without creating a clickable link. However, it's still recognized as a link by the "what links here" feature.

"Hover box" on links

In certain web browsers, when you place the cursor over a link, a tooltip may appear, displaying the content of the link's HTML title attribute. MediaWiki assigns different values to this attribute depending on the type of link: for internal wikilinks, it displays the page name and (page does not exist), if the page does not exist; for interwiki links, it displays the page name with a prefix; and for external links, it displays the URL.

The browser might also display similar information in its status bar, possibly showing which section it belongs to.

Using a piped link, even if it isn't clicked, can help clarify acronyms (like displaying "neutral point of view" as NPOV) or adding annotations. Hover boxes can also be created without links, you can customize the hover box content using markup like [[Link title|<span title="hoverbox">Display text</span>]].

You cannot include a title attribute directly within the href element for external links. Nevertheless, you can achieve a similar outcome by using a span element instead, like this: [http://www.example.com <span title="hover text on external link">www.example.com web site</span>] :
www.example.com web site

Retrieving links from a page

The MediaWiki API allows users to retrieve all links from a page. For example, you can utilize the API query called API:Links to achieve this.

Linking to a page from an image

You can utilize images to direct users to other pages. For further details, refer to the guidance on utilizing an image to link to a specific page in the help section.

Limites

Um wiki link interno é limitado até no máximo o tamanho do título da página.

Ver também