Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

What shortcuts can I use for linking to other information?

by SiteDocClan
on Nov 23, 2000 at 02:24 UTC ( #43037=sitefaqlet: print w/ replies, xml ) Need Help??

Shortcuts

(See also: Perl Monks Approved HTML tags)

Shortcuts are our shorthand way of creating links. You can use these in your writeups, and in public and private messages you send.

Shortcuts all have the form [linkspec|link text]. The link text part is optional. If you omit it (and the vertical bar separator), default link text will be used. Each shortcut type, catalogued below, has specialized default link text.

Jump down to see the shortcut usage instructions.


Available Shortcut Types:

To link to:

Nodes:

  • By Title: [title terms]
    This does a Simple Search. If exactly one node matches, the user is taken directly to that node. Otherwise, a page of search results is displayed.1
  • By Numeric Node ID: [id://nodeid]
    See How do I link to a node on this site by number? for tips on how to get the ID of a node. With the number omitted, [id://] links to that FAQlet.
  • A User:

    [username]. E.g. [vroom]vroom
    In fact, this is just a case of linking to a node by title. For each user, there is a node with the same name (their "homenode"). Linking to a user this way is really just linking to their homenode.

    You can also link to a user's adjunct pages:

  • Link to a user's scratchpad: [pad://username]
  • Link to your own scratchpad: [pad://]
  • Link to the list of a user's writeups: [by://username]
  • Link to the list of your own writeups: [by://]
  • The Message Outbox:

    You can write

      [msg://]
    
    which simply links to the Message Outbox.

    You can have your link pre-populate the "To:" field of Message Outbox by writing

      [msg://recipient]
    
    In either case, you can override the default link title text, as usual:
      [msg://|link title text]
      [msg://recipient|link title text]
    
    If you omit the title text but provide a recipient name, the recipient name will be used in formulating the link text.

    You can also pre-populate the message text ("Say:") field of the Message Outbox form, like so:

      [msg://recipient<message text|link title text]
    
    If you omit the title text but provide message text, the message text will be used in formulating the link text.

    All three arguments are optional. You can, for example, write

      [msg://<message text]
    
    If you provide message text but omit the recipient name and title text (as in the case above), the link text will be generated for you, and it will contain a ? character in place of the username. (The "To:" field in the Message Outbox form will still be left blank, however.)

    CPAN:

  • Module documentation on cpan.org: [mod://XML::Parser]
  • A distribution on cpan.org: [dist://XML-Parser] or [dist://XML-Parser-2.33]
  • General searches on search.cpan.org: [cpan://XML::Parser]
  • Module documentation on metacpan.org: [metamod://XML::Parser]
  • General searches on metacpan.org: [metacpan://XML::Parser]
  • Searches on an alternate server: [kobes://XML::Parser]2
  • A specific bug in CPAN's RT system: [rt://8138]
  • A distribution in RT: [rt://XML-Parser]
  • A search in RT: [rt://object serialization]

  • The CPAN search page: [dist://] or [mod://] (no args)
  • Randy Kobes' CPAN page: [kobes://] (no args)
  • The CPAN main page: [cpan://] (no args)
  • The CPAN RT main page: [rt://] (no args)
  • The Perl documentation:

  • Search the Perl docs: [perldoc://search terms]
  • Link directly to a the doc of a function or variable: [doc://name]
    e.g. [doc://-X|file test ops]
  • Link directly to a specific document by name: [doc://name]
    e.g. [doc://perlipc]
  • Link to a section internal to a doc: [doc://name#anchor]
    e.g. [doc://perlfaq2#Perl-Books]
    (Note, this replaces hyphens with spaces for the link text. Try it!)
  • Link to standard module docs: [mod://name]
    e.g. [mod://File::Find], [mod://strict]
    (Note that [module:// is an alias for [mod://, for those who like to type more.)
  • Perl Online Documentation site: [doc://] or [perldoc://] (no args)
  • See How do I link to the Perl documentation? for more info.

    Perl Source Code files/patches:

  • A file: [apc://file], e.g. [apc://perl.c]
  • A patch: [apc://patchNum], e.g. [apc://1575]
  • A file at a given patch number: [apc://file@patchNum], e.g. [apc://perl.c@1575]
  • The perl code repo browse/search form: [apc://] (no args)
  • Note: the scheme for this shortcut type is apc because it originally linked to the Archive of Perl Changes, hosted by ActiveState.

    Official Perl 6 documentation

  • A Synopsis (specification) by number: [aes://s06]s06
  • An Apocalypse (justification) by number: [aes://a06]a06
  • An Exegesis (explanation) by number: [aes://e06]e06
  • Line number in a Synopsis: [aes://s06/52]s06/52
  • Section in a Synopsis: [aes://s06/Invocant parameters]Invocant parameters ‐ the section title is case sensitive, the letter s is not.
  • Index of all Synopses, Apocalypses and Exegeses: [aes://] (no args)
  • UNIX/Linux man pages:

  • Search form: [man://] (no args)
  • A specific function: [man://funcname]
  • Currently, you can link to either SuSE Linux versions of the man pages (the default) or to FreeBSD versions.
    — To link to FreeBSD instead of SuSE Linux: [man://funcname;freebsd]
    You can also specify the exact version you want, if you want something other than the default (which should be the latest and greatest):
    — To link to SuSE Linux v. 7.2 man pages : [man://funcname;suse 7.2]
    — To link to FreeBSD UNIX v. 7.2 man pages : [man://funcname;freebsd 7.2]
    If the page you want is ambiguous by the name, you can specify which section of the man you want:
    — To link to time(3) rather than time(1) : [man://time;3]
    — To link to time(3) rather than time(1), FreeBSD specific : [man://time;3;freebsd]

    Google web searches:

  • Full search results: [google://search terms]
  • Link directly to first matching site: [lucky://search terms]
  • The Google search form: [google://] (no args)
  • See Google Search Help for tips.

    The Dictionary:

    Currently we use Dict.org, which searches a large number of on-line dictionaries and lexicons.

  • Look up a word: [dict://word]
  • The Dict.org search form: [dict://] (no args)
  • Jargon File Entries:

  • Look up a term: [jargon://search terms]
    Currently this simply goes to Dict.org, constraining the search to the Jargon File database.
  • The Jargon File table of contents: [jargon://] (no args)
  • Acronym definitions:

  • Search: [acronym://TIMTOWTDI]TIMTOWTDI
    Keep in mind, almost any acronym has many possible expansions.
  • The search form: [acronym://] (no args)
  • Urban Dictionary entries:

  • Look up a slang term: [ud://hurrication]hurrication
  • Urban dictionary main page: [ud://] (no args)
  • A Wikipedia entry or search:

  • Search: [wp://terms]
    This invokes Wikipedia's search function, which is smart (like PerlMonks' Search box) in that it leads directly to the matching article if there's only one.
    (Note that wikipedia:// is an alias for wp://, for those who like to type more.)
  • The Wikipedia main page: [wp://] (no args)
  • A Wiktionary entry or search:

  • Search: [wikt://word]
  • The Wiktionary main page: [wikt://] (no args)
  • A Wikibooks entry or search:

  • Search: [wb://title terms]
  • The Wikibooks main page: [wb://] (no args)
  • A Wikiquote entry or search:

  • Search: [wq://title terms]
  • The Wikiquote main page: [wq://] (no args)
  • A Wikisource entry or search:

  • Search: [ws://title terms]
  • The Wikisource main page: [ws://] (no args)
  • A page on the WikiWikiWeb (aka The Wiki):

    [c2://wiki words]
    The behavior of this shortcut depends on how many words are provided as "arguments". This is because Wiki page names must consist of at least two words. If two or more words are provided, then a wiki page title is constructed from them, and the shortcut links directly to that page. (It's up to you, the writer, to ensure it links to an existing page.) If only one word is given, then a Wiki title search is performed. This behavior reflects the capabilities provided by the Wiki site itself, which has extremely limited search capabilities.
    Note that you can be somewhat lax with spaces and capitalization. Any capitals provided will be respected; and otherwise, all "words" will be initial-capped. Note that because Wiki words can only consist of word characters (\w), all other characters will be treated as "space".
    Example: to refer to HigherOrderFunction, you can write
        [c2://HigherOrderFunction]
        [c2://higher order function]
        [c2://Higher orderFunction]
        [c2://higher-order-function]
    etc.

    To search Wiki page titles for a single term: [c2://term], e.g. [c2://perl]perl

    To go to the Wiki's Front Page: [c2://] (no args)

    Info on IMDB, such as movies and actors:

  • Search: [imdb://terms], e.g. [imdb://Office Space]Office Space
  • The IMDB main page: [imdb://] (no args)
  • Books by ISBN:

  • Look up by ISBN: [isbn://ISBN], e.g. [isbn://0596000278]ISBN 0596000278
    For best results, we recommend verifying the ISBN using Barnes And Noble's search facility, since ISBNs change with each new edition.
  • The ISBN search form: [isbn://] (no args)
  • LiveJournal:

  • Link to a LJ user: [lj://username], e.g. [lj://theorb|theorbtwo]theorbtwo
  • The LiveJournal main page: [lj://] (no args)
  • An Everything2 node:

  • By title: [e2://perl]perl
  • By ID: [e2://13372]13372
  • The Everything main page: [e2://] (no args)
  • A page on Mathworld:

  • Search by title: [mathworld://unique factorization domain]unique factorization domain
  • Mathworld main page: [mathworld://] (no args)
  • Xkcd comic strips:

  • By number: [xkcd://208]xkcd://208
  • Search strip using google, finding the most relevant: [xkcd://Bobby Tables]xkcd://Bobby Tables
  • Latest strip (at the time the link is actually followed): [xkcd://] (no args) ⇒ xkcd://
  • Internet RFCs:

  • Search: [rfc://822|rfc-822]rfc-822
  • The main page: [rfc://] (no args)
  • Arbitrary external sites:

    You can use http://, https://, and ftp://.
    With no arguments, [http://], [https://], and [ftp://] link to this usage documenation.

    General-Purpose Linking

    For situations where none of the above shortcuts can do what you need, and you think your only recourse is the explicit html <a href="...">...</a>, there is one more shortcut you can try: [href://...]

    You can use it to link to a named anchor within a document:

  • [href://#notes|notes]notes in the current node
  • [href://?node_id=786921#titles|page titles]page titles in another node.
  • You can use it to link to a node with additional CGI parameters:
  • [href://?node_id=43037;displaytype=xml|this node xml]this node xml
  • You can use it to link to another site:
  • [href://http://www.perl.org/]http://www.perl.org/
  • [href://] by itself (no args) links to this usage documentation.

    link is an alias for href.

    See New bracket-link stuff.

    Show the time!

    One special shortcut type doesn't make links. The [localtime://] shortcut is really a "macro" which PerlMonks replaces with a formatted time, localized for the user. Each user will see the time you type in their timezone, as set in their Timezone Settings. This is similar to how most times (like posting times) are shown on the site.

  • The shortcut needs as argument a time in ISO 8601 order, that is, the first four digits are year, then two digits for months, two digits for days, two digits for hours, two digits for minutes, two digits for seconds (optional). Punctutation or separators like T are ignored. Usually you want to use a UTC suffix so the date is interpretted as UTC (Coordinated Universal Time, GMT); otherwise it's interpretted as server time which is not too useful. Other timezone designators or fancy formats like day of year or week of year are not allowed. For example [localtime://20081201144400UTC] means 1st December 2001, 14:44 UTC, which renders as Dec 01, 2008 at 14:44 UTC; whereas [localtime://20081201144400] means 14:44 server time, and renders as Dec 01, 2008 at 19:44 UTC.
  • In the Chatterbox, the time displayed for a [localtime://] without argument is fixed at the point in time when the user submitted the public message.
  • In a node, the time for [localtime://] without argument is updated to the current time each time the node is rendered.

  • Using Shortcuts

    Please test your links before posting them.

    Rule #1: If you're writing a node, use the Preview button!
    There are several ways to try out a link before using it in a post or in the Chatterbox:
    1. /msg yourself
    2. Enter the full link (with or without the square brackets) in the Search box at the top of the page. This "executes" the link immediately, taking you to wherever the link would go if you were use it in a post or message. Note that this is only useful to test the target of a link, not the title or clickability.
    Please avoid using the public chatterbox to test links. It is very annoying to your fellow users.

    All Links Within PerlMonks Should Be Relative

    Be sure to use a relative URL when linking to any location on the perlmonks web site. That is, do not include the http://www.perlmonks.org part! If you include http://www.perlmonks.org, it creates a "logout link". This means that people who follow (click on) the link — including you! — might find themselves looking at your intended target node as a non-logged-in user (i.e. Anonymous Monk). This is A Bad Thing.

    Therefore, constructing a link like
    <a href="http://www.perlmonks.com/index.pl?node_id=43037">shortcuts</a>
    is not as good as [http://www.perlmonks.com/index.pl?node_id=43037|shortcuts]
    which is not as good as <a href="/index.pl?node_id=43037">shortcuts</a>. Best of all is to use [id://43037|shortcuts].

    Specifying Link Titles

    To specify the text to be displayed as the clickable part of your link (its "title"), enter the text after the "url", separated from it by a | (vertical bar, aka pipe) character within the [] (square bracket) delimiters.
    For example, [http://www.perl.com|Perl.com] is displayed as Perl.com.

    In most cases, if you do not specify a title, your link's "target" (the part after the ://) will be used as the link text. E.g., [perldoc://perlfaq]perlfaq.
    Exceptions include:

    • [http://] and kin use the entire URL. [http://www.perl.org/]http://www.perl.org/
    • [isbn://] prepends "ISBN". [isbn://0596000278]ISBN 0596000278
    • [id://] uses the target node's title. [id://483072]PerlMonks FAQ
    • [pad://] makes a default title based on whose pad is being linked to. The [pad://vroom]vroom's scratchpad; the default title for [pad://] is my pad.
    • [localtime://] always renders as a time string (not a clickable link), irrespective of any title text given. [localtime://|When?] ⇒ Jul 24, 2014 at 13:05 UTC

    Most shortcut types provide useful default titles when no target arguments are specified. A full list of examples is available in the test cases for parameterless shortcuts. See the second column.


    Notes:

    1 - This is the same as entering your search terms into the Search box at the top of most nodes.
    Node titles aren't required to be unique on PerlMonks, so there's always a possibility for ambiguity when linking/searching by title.

    It's possible to disambiguate by node type (though this only helps if the conflicting nodes are of different types). To do so, use the href:// style and add ;type=type to the shortcut. Example:
    [href://?node=message;type=dbtable|message (dbtable)]message (dbtable).

    2 - You can also use [kobe://XML::Parser] (no "s"). This is provided for backward compatibility only. It will always be supported, but the kobes form is considered "correct" and is recommended for all new links.


    Back to the PerlMonks FAQ
    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (14)
    As of 2014-07-24 13:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (160 votes), past polls