Topic on Project:Support desk

Jump to navigation Jump to search

How can I have a thumbnail without a link to the image page?

Holygamer (talkcontribs)

I can do this to just display an image in it's orignal size without the image having a link to the image page[[Image:ImageName.png|link=|caption]]

However if I add "thumb" to it, it then has a link to the image page again even though I told it to not have a link like this:


How can I get a thumbnail to NOT link to the image page?

Subfader (talkcontribs)
Holygamer (talkcontribs)

I already looked at that page before I posted my question. That page didn't have a solution. I've re-edited my question as it didn't appear properly before.

Subfader (talkcontribs)

Works as advertised: [[File:example.jpg|link=|thumb|150px|caption]]

Holygamer (talkcontribs)

That picture still has a link to the file description page when I hover over the square in the bottom right corner.

Reach Out to the Truth (talkcontribs)

The link parameter only affects the link on the image itself. The icon below always goes to the image description page regardless of where the image links to. That is its purpose, and I don't know if it's possible to change that behaviour.

Bawolff (talkcontribs)

The best you can do [[File:example.jpg|link=|frame|caption]] - however then the image isn't scaled. (I suppose alternative is hide the magnification icon with css...)

Holygamer (talkcontribs)

It's an SEO issue. The search engines still see the link in the code even if you hide it with CSS. Even if I don't have a caption there is still an "enlarge" link. Is there any way to hack the code to remove the enlarge link?

Bawolff (talkcontribs)

/me believes all that SEO stuff is a bunch of hocus pocus ;)

Note, you can make a template (lets call it template:thumb) that would do something like:

<div class="thumb tright">
<div style="width: {{#expr:{{{2}}}+2}}px;" class="thumbinner">[[file:{{{1}}}|{{{2}}}px|link=]]
<div class="thumbcaption">

And then you could call like {{thumb|Example.png|120|caption=An Example}}, which would make:

{{{caption|An Example}}}

Officially we discourage people from making custom patches to MW. Things tend to break when people do that, especially on upgrade, and then they blame us ;). However, I will note the relavent code is in the Linker::makeThumbLink2 method (in includes/Linker.php), specifically the $zoomIcon variable.

Holygamer (talkcontribs)

Hi, I tried to make that template but I get the following error message: Expression error: Unrecognised punctuation character "{"

Subfader (talkcontribs)

or use CSS: put the image code in a span with some classname

Holygamer (talkcontribs)

Bawolff, Am I just supposed to use that first lot of code you gave me in a template? I created that template but I get the following error message when I save the template: Expression error: Unrecognised punctuation character "{"

You also mentioned the Linker::makeThumbLink2 method but I've no idea what I'm supposed to do. I'm not familiar with code.

Subfader, could you please suggest what CSS I could use?

Bawolff (talkcontribs)

The template may have an error on the template page, but it should work when you actually use it I think (The error more comes from it not having an image width to substitute in). I strongly suggest you avoid modifying Linker::makeThumbLink2 unless you absolutely have to, and if you do, that you know what you're doing - since custom patches make things rather complicated. I only mentioned it because if push comes to shove you can do that as a last resort.

Dave88008 (talkcontribs)

Change where the link goes with "link=" parameter.

Reply to "How can I have a thumbnail without a link to the image page?"