Help:Navigational image

Jump to: navigation, search
MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/-

If you are not reading this in Meta it is advised that you go there to view this page otherwise some links in this page will not work

Although not a 'feature' of the MediaWiki software, an image can be made to link to a specified page if desired.

Some people find trawling through this page understandably confusing, so here is the short version:

  • You can use the re-direct feature on an image page, but when used, the target page shows all sorts of unwanted information that gets transcluded from the image page itself.
  • For website such as Wikipedia that preclude the use of embedding external images you can superimpose hyperlinks onto images.

For more detailed explanations, see below.


Method 1: Employing image redirects

This method does not seem to work anymore.

One way to do this is by putting a redirect on the image page. For example, on Meta the internal image File:Catapult.jpg is linked to the page Help:Redirect. The image 60px from Commons, redirecting on Meta to the Main Page, is not displayed.

If the redirect is within the same project, then a redirect message with a link to the image page (MediaWiki:Redirectedfrom) is inserted on the target page.

To use the same image on another page without a redirect or with a different target, a copy of the image has to be uploaded under another name. However, an image on Commons may have its own image page on each project, e.g. File:Zuid Holland-Position.png, which could have a redirect on the image page on this project, which would then be accessible by the link

This method produces several problems:

  • The URL does not display the correct address.
  • Search engines will see multiple pages with the exact same material on it.
  • You will get an annoying "(Redirected from..." artifact on some skins.

To correct these problems, see the fix here: Force all redirects to be client side redirects (HTTP 302 Temporary Redirect)

Method 2: Using the external link format

In projects that allow the embedding of external_images (in which case you see images in the lefthand column of the table below) there are the following possibilities:

(The image can be an internally or externally held image, and the target can be an external URL or a wiki page).

What it looks like What you type
An external image linking to an external page, image, etc.:



An external image linking to an internal page: does not work!


An external image linking to an internal page with external link style, with :


An internal image linking to an internal page with external link style:
http:../upload/b/bc/Wiki.png Again, there is no automatic link to the image page, use Image:wiki.png. With this method, the same image can be used on another page linking as usual to the image page, or linking to a different target.

[{{SERVER}}{{localurl:Help:Redirect}} http:../upload/b/bc/Wiki.png]


If you don't want the small icon indicating it is an external link to appear, because it is actually an internal link (and looks untidy), you can surround the image link with code to supress it. This will be most useful to people running their own corporate or independent wikis, rather than Wikimedia sites.
If you are looking at this on Meta, you will not see the effect here as it doesn't allow embedding of 'external' images...

<span class="plainlinks">[{{SERVER}}{{localurl:Help:Redirect}} http:../upload/b/bc/Wiki.png]</span>
  • Using 'span' instead of 'div' means a navigational image can be embedded within text without linebreaks spoiling the show

To make it easy to create navigational images based on the above method, a template can be employed. In this example a template called 'clickpic' is created that takes two parameters: target page name and image path. ('clickpic' template not to be confused with 'click' template mentioned in Method 3).


For more info on using this template, see User:CharlesC/Template for navigational images on Mediawiki websites.

Now you can easily have proper internal linking with images in MediaWiki sites - hooray!

  • Create template called 'clickpic'. Probably easiest method is to type 'template:clickpic' at the end of your wiki's URL, then click 'edit'.
  • This is the text you need add to your template page (see Meta's one at Template:Clickpic):
<span class="plainlinks">[{{SERVER}}{{localurl:{{{1}}}}} {{{2}}}]</span>
  • Using the template above, this is all that needs to be written to create a navigational image:
{{clickpic|Main Page|http:../upload/b/bc/Wiki.png}}
  • This creates a navigational image that has 'Main Page' as the target page and displays the image stored at 'http:../upload/b/bc/Wiki.png'


One application is linking a small version of an image to a large one. Example where both are external:




The alternate text is the name of the image, after the last slash in the URL. If you have control over the image, give it a meaningful name; you could even include a text like "click to enlarge" in the name.

Method 3: Superimposing a hyperlink onto an image

A linked text can be superimposed onto an image, see Help:Composite images. In particular there can be a dummy text such as an &nbsp; character in a very large font, covering the whole image.

Using template:navimg ( talk edit history links ):

gives: topbottom

Similarly with template:navimgx ( talk edit history links ) for an external link:


However, if the browser is set to ignore font sizes specified in web pages then only part of the area in the image links to the specified page, and the rest of the image to the image page. Check the hoverbox or status line to see the target at any position of the mouse cursor. Some versions of the template have the same hoverbox for the two areas.

The image cannot be inline. Positioning can be done e.g. with a table.

See also:

Method 4:Use ImageMap

All Wikipedia sites seem to have the mw:Extension:ImageMap installed. Although aimed at multiple areas with different links on an image, one can use it also to link the whole image to a single page. It works on internal and interwiki links.

<imagemap> Image:Foo.jpg|200px|Help on images (text outside link area) default Help on images desc none

  1. use desc bottom-left to have a blue i link to the image page


Image:Foo.jpg|200px|Help on images (text outside link area)
desc none
#use desc bottom-left to have a blue i link to the image page
default [[w:Help:Images_and_other_uploaded_files]]

See also

Links to other help pages

Help contents | search (all help pages)
Meta | Wikinews | Wikipedia | Wikiquote | Wiktionary | commons: | mw: | b: | s:
Go | Search | Stop words | URL | Namespace | Page name | Section
Backlinks | Link | Piped link | Interwiki link | Redirect | Category | Image page
Logging in and preferences
Logging in | Preferences | User style
Advanced editing | Editing FAQ | Edit toolbar | Export
Editing shortcuts
Tracking changes
Recent changes (enhanced) | Related changes | Watching pages | Diff
Page history | Edit summary | User contributions | Minor edit | Patrolled edit
Style & formatting
Wikitext examples | Reference card
HTML in wikitext | HTML elements
List | Table | Sorting
Mathematical symbols on English Wikipedia
Special input and output
Inputbox | Special characters | Displaying a formula | Images and other uploaded files | EasyTimeline
Advanced functioning
Template | Advanced templates | Parser function | ParserFunctions | Parameter default | Variable | Magic word | System message | Substitution
Array | Calculation
Page management
Starting a new page | Renaming (moving) a page | Maintenance | Merging and moving pages | Protecting pages
Resolving disputes | Deleting a page
Special pages
Talk page | Testing | Sandbox
Lists of resources
Lists of Categories | Copyrights | Infobox
Redirect | Reference Desk | Shortcuts | Stub types

Other languages: English (en) +/-