Next: , Previous: Handling links, Up: Hyperlinks


4.5 Link abbreviations

Long URLs can be cumbersome to type, and often many similar links are needed in a document. For this you can use link abbreviations. An abbreviated link looks like this

     [[linkword:tag][description]]

where the tag is optional. Such abbreviations are resolved according to the information in the variable org-link-abbrev-alist that relates the linkwords to replacement text. Here is an example:

     (setq org-link-abbrev-alist
       '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
         ("google"   . "http://www.google.com/search?q=")
         ("ads"      . "http://adsabs.harvard.edu/cgi-bin/
                        nph-abs_connect?author=%s&db_key=AST")))

If the replacement text contains the string `%s', it will be replaced with the tag. Otherwise the tag will be appended to the string in order to create the link. You may also specify a function that will be called with the tag as the only argument to create the link.

With the above setting, you could link to a specific bug with [[bugzilla:129]], search the web for `OrgMode' with [[google:OrgMode]] and find out what the Org-mode author is doing besides Emacs hacking with [[ads:Dominik,C]].

If you need special abbreviations just for a single Org-mode buffer, you can define them in the file with

     #+LINK: bugzilla  http://10.1.2.9/bugzilla/show_bug.cgi?id=
     #+LINK: google    http://www.google.com/search?q=%s

In-buffer completion see Completion can be used after `[' to complete link abbreviations.