[pmwiki-users] External links to the same host

Patrick R. Michaud pmichaud at pobox.com
Sun Feb 18 23:26:16 CST 2007


On Mon, Feb 19, 2007 at 04:02:16PM +1100, Kathryn Andersen wrote:
> > > PmWiki divides links into "internal" (links to wiki pages)
> > > and "external" (all other links). ?Now, it's nice to be able
> > > to indicate the differences, but there is really another class of links:
> > > links that are outside the wiki, but on the same host. ?That is,
> > > while they are external to the wiki, they aren't really external to
> > > the *site*.
> 
> Yes, that's what I meant.  Another class.  If I wanted to turn it off
> altogether, I'd just alter the link format.  But what I would prefer
> would be that *true* external links would have one class, and
> within-the-site links (including links to attached files) would have
> another class.  I wouldn't mind if links to attached files had their own
> class as well, so long as there is some way of distinguising between
> real external links, and within-the-site links.

PmWiki doesn't really have a way to distinguish internal vs. external
http: links -- it sees them all as being http: links.  

And there's always the question of "what defines a site" --
would "www.example.com" be considered external to "example.com"?
How about "host1.example.com" and "host2.example.com"?  These
definitions aren't always so clear.

However, if you're willing to write "within the site" links
using a different InterMap prefix, then it's very easy to style
them differently (even to the point of using different HTML output).
PmWiki already provides a 'Path:' InterMap shortcut that means
"on the same server" -- to have it styled differently one can do:

  $IMapLinkFmt['Path:'] = 
    "<a class='urllink internal' href='\$LinkUrl'>\$LinkText</a>";

Then instead of http://myserver.com/path/to/file.ext one would
write Path:/path/to/file.ext .  This also has the advantage that
the links produced are truly relative links (i.e., 
href='/path/to/file.ext').

I admit that this doesn't help in the case where an author wants
the url to display "http://myserver.com/..." as the link text.
For that we'd have to make some substantial modifications to the
LinkIMap() function, or introduce some special markups.
And I'd still need a consensus as to exactly what constitutes 
"external" versus "internal" links.

Pm



More information about the pmwiki-users mailing list