Link Reference in the Wiki: Difference between revisions

From RCGRS MRT Wiki
Jump to navigation Jump to search
m (Cosmetic changes)
m (Minor tweaking to improve clarity and completeness.)
Line 10: Line 10:
or
or
:<code><nowiki>[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages]]</nowiki></code> ⟹ [[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages]]
:<code><nowiki>[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages]]</nowiki></code> ⟹ [[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages]]
But note that using double brackets kind of ignores the second set, taking it as additional text around the reference.<br>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":
But note that using double brackets kind of ignores the second set, taking it as additional text around the reference.<br>Also, note that the last two examples are just numbers. Not very useful or informative as to what is being referenced. To fix that, those last two examples could include text that provides some sensible text to indicate what the reference links to. (This is called "link text" in some of the help files.) Here are examples with "link text":
:<code><nowiki>[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]</nowiki></code> ⟹ [https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]
:<code><nowiki>[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]</nowiki></code> ⟹ [https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]
:<code><nowiki>[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages|List all pages]]</nowiki></code> ⟹ [[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]]
:<code><nowiki>[[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages|List all pages]]</nowiki></code> ⟹ [[https://www.rcgrs.com/mrtwiki/index.php?title=Special:AllPages List all pages]]
Now, because these are full URLs (they include the communications protocol specification of <code>https://</code>) 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 <code>www.rcgrs.com/mrtwiki/index.php?title=</code> as part of it. The part that specifies this is the <code>rcgrs.com</code> 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:
Now, because these are full URLs (they include the communications protocol specification of <code>https://</code>) 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 <code>www.rcgrs.com/mrtwiki/index.php?title=</code> as part of it. This is the "domain" of the page, followed by any directories the reference resides within, and option arguments that tell the HTML processor more about what should be included in the displayed reference. (''Don't worry if you don't understand that part. Just think of it as the "reference text" as a whole.'') The part that specifies the domain, <code>rcgrs.com</code>, 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:
:<code><nowiki>[[Special:AllPages]]</nowiki></code> ⟹ [[Special:AllPages]]
:<code><nowiki>[[Special:AllPages]]</nowiki></code> ⟹ [[Special:AllPages]]
:<code><nowiki>[[Special:AllPages|List all pages]]</nowiki></code> ⟹ [[Special:AllPages|List all pages]]
:<code><nowiki>[[Special:AllPages|List all pages]]</nowiki></code> ⟹ [[Special:AllPages|List all pages]]
Line 27: Line 27:
So wrap it in another set of square brackets, since it is an '''''external''''' page:
So wrap it in another set of square brackets, since it is an '''''external''''' page:
:<code><nowiki>[[Help:Contents|Attempt to display MediaWiki help]]</nowiki></code> ⟹ [[Help:Contents|Attempt to display MediaWiki help]]
:<code><nowiki>[[Help:Contents|Attempt to display MediaWiki help]]</nowiki></code> ⟹ [[Help:Contents|Attempt to display MediaWiki help]]
At least it is recognized 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:
At least it is recognized 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 MediaWiki assumes 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:
:<code><nowiki>[https://www.MediaWiki.org/Help:Contents|Attempt to display MediaWiki help]</nowiki></code> ⟹ [https://www.MediaWiki.org/Help:Contents Attempt to display MediaWiki help]
:<code><nowiki>[https://www.MediaWiki.org/Help:Contents|Attempt to display MediaWiki help]</nowiki></code> ⟹ [https://www.MediaWiki.org/Help:Contents 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:
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 reference text:
:<code><nowiki>[https://www.MediaWiki.org/wiki/Help:Contents|Attempt to display MediaWiki help]</nowiki></code> ⟹ [[mediawikiwiki:Help:Contents|Attempt to display MediaWiki help]]
:<code><nowiki>[https://www.MediaWiki.org/wiki/Help:Contents|Attempt to display MediaWiki help]</nowiki></code> ⟹ [[mediawikiwiki:Help:Contents|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.
OK, that works. How did I know it was in that '''wiki''' directory? Well, 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.<br>
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.<br>
Line 39: Line 39:
:<code><nowiki>[[MediaWikiwiki:Help:Contents|Attempt to display MediaWiki help]]</nowiki></code> ⟹ [[MediaWikiwiki:Help:Contents|Attempt to display MediaWiki help]]
:<code><nowiki>[[MediaWikiwiki:Help:Contents|Attempt to display MediaWiki help]]</nowiki></code> ⟹ [[MediaWikiwiki:Help:Contents|Attempt to display MediaWiki help]]
Note that I have now wrapped the reference in double square brackets and delimited the "link text" with a pipe ("|") rather than a space. This is because it is now considered an '''''internal''''' reference, and must therefore follow that syntax.
Note that I have now wrapped the reference in double square brackets and delimited the "link text" with a pipe ("|") rather than a space. This is because it is now considered an '''''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.
I hope that helps you when you are trying to figure out why your links aren't working. If you have any comments or questions regarding this, just click on the "talk" link behind my name below and put your comments and questions in there. I'll get notified and answer as soon and as best as I can.<br>Have fun.


--[[User:DErik|DErik]] ([[User talk:DErik|talk]]) 23:47, 2 May 2023 (PDT)
--[[User:DErik|DErik]] ([[User talk:DErik|talk]]) 23:47, 2 May 2023 (PDT)

Revision as of 23:14, 2 May 2023

This is a new article being developed by Don Erikstrup (DErik (talk) 18:20, 2 May 2023 (PDT))

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]

or

[[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, note that the last two examples are just numbers. Not very useful or informative as to what is being referenced. To fix that, those last two examples could include text that provides some sensible text to indicate what the reference links to. (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 it. This is the "domain" of the page, followed by any directories the reference resides within, and option arguments that tell the HTML processor more about what should be included in the displayed reference. (Don't worry if you don't understand that part. Just think of it as the "reference text" as a whole.) The part that specifies the domain, rcgrs.com, 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

When trying to reference an internal page with just one set of square brackets, this happens:

[Special:AllPages] ⟹ [Special:AllPages]
[Special:AllPages|List all pages] ⟹ [Special:AllPages|List all pages]

Well that just doesn'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

At least it is recognized 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 MediaWiki assumes 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 reference text:

[https://www.MediaWiki.org/wiki/Help:Contents|Attempt to display MediaWiki help]Attempt to display MediaWiki help

OK, that works. How did I know it was in that wiki directory? Well, 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 I have now wrapped the reference in double square brackets and delimited the "link text" with a pipe ("|") rather than a space. This is because it is now considered an 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. If you have any comments or questions regarding this, just click on the "talk" link behind my name below and put your comments and questions in there. I'll get notified and answer as soon and as best as I can.
Have fun.

--DErik (talk) 23:47, 2 May 2023 (PDT)