Documentation:MediaWiki Basics/Modifying Link Behavior

From UBC Wiki

For general help on creating links go to: Links Help This page will describe how to modify the behavior of links to documents that you have uploaded to the wiki. This includes:

  • pdfs - when you want them to open directly from your wiki page
  • word docs - when you want them to download directly to your users' computers.

These tips are work arounds which will bypass the normal wiki process of linking to the upload page. This has both advantages and disadvantages. The advantage is that users can see (from the upload page) where the file came from, it's author, copyright status and license for use. The disadvantage is that it requires an additional step for users to click on the link from the upload page before they can see the content of the link - this can be frustrating and is likely what has led you here.

The work around is not very intuitive, so we've prepared this documentation.

Getting pdf links to open directly

Step 1: Upload Your PDF to the wiki

  • Look for the option to Upload File from the left menu under Tools.
  • Once you have finished uploading, you will be taken to a file page that looks like this:

example of an uploaded file ready for embedding on a page

Step 2: Copy the link

After clicking on the link (from the file upload page above), you will see that the url has changed. It now contains the word "image" . Copy this new link.

sample pdf and direct url


Step 3: Create your hyperlink in your wiki page

Choose the text in your wiki page you want to hyperlink. When you get the dialogue box for the hyperlink - enter the new link (containing the word "image") and be sure to define it as an EXTERNAL link.

creating a hyperlink to open a pdf directly from a wiki page


Your new link should look like this on your wiki page (editing screen) and should (when saved) open to the pdf directly! Voila!

Sample direct url in wiki page


Getting Word docs to download directly

Step 1: Upload your Word docx file

Be sure to copy the link location from the file's page on the wiki (you get to this by clicking on the file once you have uploaded it).

Sample file upload ready for page linking


Step 2: Create your hyperlink in your wiki page

Choose the text in your wiki page you want to hyperlink. When you get the dialogue box for the hyperlink - enter the new link (containing the word "image") and be sure to define it as an EXTERNAL link.

creating a hyperlink to open a pdf directly from a wiki page


Your new link should look like this on your wiki page (editing screen) and should (when saved) download the word doc directly! Voila!


Sample direct url on wiki editing screen