Difference between revisions of "InterPageLinks"

From Exalted - Unofficial Wiki
Jump to: navigation, search
m (link fix)
(This finally works)
 
Line 3: Line 3:
 
Interpage linking is trivial to accomplish with raw HTML, as you can embed named anchors on pages with <tt><nowiki><a name="anchorname"></nowiki></tt> tags. If a page like <tt>foo</tt> has such a tag in a section, then a URL containing <tt>foo#anchorname</tt> will lead right to this section.
 
Interpage linking is trivial to accomplish with raw HTML, as you can embed named anchors on pages with <tt><nowiki><a name="anchorname"></nowiki></tt> tags. If a page like <tt>foo</tt> has such a tag in a section, then a URL containing <tt>foo#anchorname</tt> will lead right to this section.
  
[[UseModWiki]] has a syntax for supporting the addition of named anchors. Prior to a header line (i.e. one using syntax similar to <tt><nowiki>=== Header ===</nowiki></tt>), you can embed a tag like so <tt><nowiki>[#anchorname]</nowiki></tt>. Unfortunately, the rest of the implementation of this feature is so colossally stupid that it isn't really worth using.
+
Fortunately, now that [[UseModWiki]] has been ditched, this type of linking is quite simple. Any time you use a section header in a page, MediaWiki software automatically creates a named anchor for it (with the name set to the text of the header). Further, the linking markup contains a shorthand for linking to these anchors.
  
In the first place, the above wiki syntax translates not into <tt><nowiki><a name="anchorname"></nowiki></tt>, but <tt><nowiki><a name="#anchorname"></nowiki></tt>. This means the URL to access it must be <tt>foo##anchorname</tt>. This would not be so bad, but it turns out to be very hard to convince [[UseModWiki]] to actually build a link like this.
+
For example, the [[ReaderCentricDesign]] page contains sections, including one called "Going Forward" section. Any of the following will link directly to that section:
  
For example, I have placed name anchors on the [[ReaderCentricDesign]] page. One of these is for the "Going Forward" section, marked using the wiki code <tt><nowiki>[#goingforward]</nowiki></tt>. You would think that at least one of the following might generate links to this section, but none of them do:
+
:<tt><nowiki>[[ReaderCentricDesign#Going Forward]]</nowiki></tt> -> [[ReaderCentricDesign#Going Forward]]
 
+
:<tt><nowiki>[[ReaderCentricDesign#Going Forward|how to go forward]]</nowiki></tt> -> [[ReaderCentricDesign#Going Forward|how to go forward]]
:''markup'' -> ''result''
 
:<tt><nowiki>ReaderCentricDesign#goingforward</nowiki></tt> -> [[ReaderCentricDesign]]#goingforward
 
:<tt><nowiki>ReaderCentricDesign##goingforward</nowiki></tt> -> [[ReaderCentricDesign]]##goingforward
 
:<tt><nowiki>[[ReaderCentricDesign#goingforward]]</nowiki></tt> -> [[ReaderCentricDesign#goingforward]]
 
:<tt><nowiki>[[ReaderCentricDesign##goingforward]]</nowiki></tt> -> [[ReaderCentricDesign##goingforward]]
 
:<tt><nowiki>[ReaderCentricDesign#goingforward]</nowiki></tt> -> [[[ReaderCentricDesign]]#goingforward]
 
:<tt><nowiki>[ReaderCentricDesign##goingforward]</nowiki></tt> -> [[[ReaderCentricDesign]]##goingforward]
 
:<tt><nowiki>[ReaderCentricDesign%23goingforward]</nowiki></tt> -> [[[ReaderCentricDesign]]%23goingforward]
 
:<tt><nowiki>[ReaderCentricDesign%23%23goingforward]</nowiki></tt> -> [[[ReaderCentricDesign]]%23%23goingforward]
 
 
 
The only syntax I can get to work is:
 
 
 
:<tt><nowiki>[http://exalted.xi.co.nz/wiki/wiki.pl?ReaderCentricDesign%23%23goingforward this one]</nowiki></tt> -> [http://exalted.xi.co.nz/wiki/wiki.pl?ReaderCentricDesign%23%23goingforward this one]
 
 
 
That's right. It ''requires'' a full server path, and gets marked as an external link. This design choice is so foolish that it makes me want to track down the source, print out 1000 copies, bind them into a big book, find the programmer and bludgeon him with it. Why even bother releasing the feature at that point.
 
 
 
([[MediaWiki]], by the way, generates sensible name anchors for all header tags automatically.)
 
 
 
-- [[Wordman]]
 
 
 
I tracked down the source for this. It is trivial to fix. Basically, the code is largely written correctly. The problem is the code that generates the <tt><nowiki><a name="#anchorname"></nowiki></tt> tag. If this were change to generate <tt><nowiki><a name="anchorname"></nowiki></tt> instead, a wiki-word link like <tt><nowiki>ReaderCentricDesign#goingforward</nowiki></tt> would work. This is a single character change in the source code, I think. It's tough to test, because I don't know which version of the code this site uses.
 
 
 
-- [[Wordman]]
 
 
 
There is an [http://www.usemod.com/cgi-bin/wiki.pl?WikiPatches/AnchorsInFreeLinkBugFix official patch] for this problem created July 14, 2008. -- [[Wordman]]
 

Latest revision as of 15:43, 21 April 2010

In rereading ReaderCentricDesign, I realized that items on individual pages is not a minimum condition for it. The minimum condition is individual references. That is, there can be many items on a given page, as long as it is possible to link directly to them from other pages. This is possible with interpage linking, which allows a web link to target a specific section of a page, provided that section is marked in a special way.

Interpage linking is trivial to accomplish with raw HTML, as you can embed named anchors on pages with <a name="anchorname"> tags. If a page like foo has such a tag in a section, then a URL containing foo#anchorname will lead right to this section.

Fortunately, now that UseModWiki has been ditched, this type of linking is quite simple. Any time you use a section header in a page, MediaWiki software automatically creates a named anchor for it (with the name set to the text of the header). Further, the linking markup contains a shorthand for linking to these anchors.

For example, the ReaderCentricDesign page contains sections, including one called "Going Forward" section. Any of the following will link directly to that section:

[[ReaderCentricDesign#Going Forward]] -> ReaderCentricDesign#Going Forward
[[ReaderCentricDesign#Going Forward|how to go forward]] -> how to go forward