Link Reference in the Wiki

From RCGRS MRT Wiki
Revision as of 16:52, 2 May 2023 by DErik (talk | contribs) (Created page with "One of the confusing things about creating links to pages is that the syntax of the link reference is dependent on the "domain" of the page, which may be this instance of MediaWiki, or some other instance like Wikipedia, or MediaWiki itself (which really is its own instance of the MediaWiki application). In some instances, the full URL is needed, in others, the substitution of <code>"mediawikiwiki:"</code> for <code><nowiki>"https://MediaWiki.org/"</nowiki></code> works,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

One of the confusing things about creating links to pages is that the syntax of the link reference is dependent on the "domain" of the page, which may be this instance of MediaWiki, or some other instance like Wikipedia, or MediaWiki itself (which really is its own instance of the MediaWiki application). In some instances, the full URL is needed, in others, the substitution of "mediawikiwiki:" for "https://MediaWiki.org/" works, and others do not require either the full URL or the substitution. For example: the "Special" page that lists all the pages in this instance of MediaWiki (i.e., the RCGRS.com version) has the full URL of
https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPageshttps://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages
and it can be included in any page just that way. It can also be referenced with single or double brackets around it like so:
[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages][1]
[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages]] ⟹ [[2]]
But note that using double brackets kind of ignores the second set, taking it as additional text around the reference.
Also, those last two examples could include text that replaces the reference text. This is called "link text" in some of the help files). Here are examples with "link text":
[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]List all pages
[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages|List all pages]] ⟹ [List all pages]
Now, because these are full URLs (they include the communications protocol specification of https://) they are treated as external links. But the "Special" pages are typically internal pages. That is, they are specific to this instance of the MediaWiki installation. Note that the URL has www.rcgrs.com/mrtwiki/index.php?title= as part of the it. The part that specifies this is the rcgrs.com domain is how we know it is really specific to this MediaWiki installation instance; other instances have different domains. So, since it is internal, it can be referenced with just the page title, with or without additional text, wrapped in double square brackets, like so:
[[Special:AllPages]]Special:AllPages
[[Special:AllPages|List all pages]]List all pages
But trying to reference an internal page with just one set of square brackets, here's what happens:
[Special:AllPages] ⟹ [Special:AllPages]
[Special:AllPages|List all pages] ⟹ [Special:AllPages|List all pages]
Well that didn't work at all. It doesn't even recognize it as a link.
Let's try doing the last form to reference the MediaWiki main help file, which is external:
[Help:Contents|Attempt to display MediaWiki help] ⟹ [Help:Contents|Attempt to display MediaWiki help]
It again doesn't even recognize it as a link. So wrap it in another set of square brackets, since it is an external page:
[[Help:Contents|Attempt to display MediaWiki help]]Attempt to display MediaWiki help
It at least recognized it as a link, but note that the reference is in red letters. This indicates the page could not be found by MediaWiki. Why? Because it needs the protocol (at least a double slash ("//"), I think they assume the "http:" or "https:" if just the "//" is present - I recall reading that somewhere) and domain specified. Let's try it again with that added:
[https://www.MediaWiki.org/Help:Contents|Attempt to display MediaWiki help]Attempt to display MediaWiki help
Well, that recognized it as a link reference, but the link doesn't work (not found error). Why? Because MediaWiki actually puts this stuff in a directory called wiki. So we need to include that in the link text:
[https://www.MediaWiki.org/wiki/Help:Contents|Attempt to display MediaWiki help]Attempt to display MediaWiki help
How did I know it was in that wiki directory? I had looked up help via some other link and took note of the actual URL. Also, when I got the "404 Not found" error, the page asked if I really meant wiki/Help:Contents. That was nice of them.
Now recall my mention of "mediawikiwiki:"? Let's try substituting that for the protocol and MediaWiki domain specification in a reference to their help file. First the full reference as it would normally be done:
[http://www.MediaWiki.org/wiki/Help:Contents Attempt to display MediaWiki help]Attempt to display MediaWiki help
Now the revised reference:
[[MediaWikiwiki:Help:Contents|Attempt to display MediaWiki help]]Attempt to display MediaWiki help
Note that reference is now wrapped in double square brackets and the "link text" is delimited with a pipe ("|") rather than a space. This is because it is now considered and internal reference, and must therefore follow that syntax.
I hope that helps you when you are trying to figure out why your links aren't working. Have fun.