Template:Portal/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>WOSlinker
update transclusion count
meta>Eubulides
Describe proposed title= parameter, along with link= and alt= proposed behavior.
Line 8: Line 8:
The units assumed for <code>size</code> (the width of the image) and <code>boxsize</code> (the width of the box containing the image and portal link) are pixels (px). By default, the box is surrounded by a margin of width 0.5em, but this can be customized using <code>margin=''top'' ''right'' ''bottom'' ''left''</code> (e.g. <code style="font-size:95%;">margin=0.25em 0 0.25em 0.25em</code>) or removed using <code>margin=0</code> (zero).
The units assumed for <code>size</code> (the width of the image) and <code>boxsize</code> (the width of the box containing the image and portal link) are pixels (px). By default, the box is surrounded by a margin of width 0.5em, but this can be customized using <code>margin=''top'' ''right'' ''bottom'' ''left''</code> (e.g. <code style="font-size:95%;">margin=0.25em 0 0.25em 0.25em</code>) or removed using <code>margin=0</code> (zero).


By default the image is assumed to be purely decorative, and no link is generated for it; in this case the image should not have a license that requires attribution, for technical reasons involving copyright law and the current implementation of Wikipedia. However, if <code>alt=''Alt text''</code> is specified (see [[WP:ALT]]), a link to the image's page is generated; this link can be overridden with <code>link=''Page to link to''</code>. As per [[WP:ALT]], if a link is specified, alt text for that link's function should also be specified.
By default the image is assumed to be purely decorative in the [[WP:ALT #Purely decorative images|W3C sense]] that it conveys no significant information other than what is in the adjacent text and nothing should happen when you click on it. No alt text is generated for the image, and the image does not link to anything. The image's [[HTML#Attributes|title attribute]] contains a URL to the file page, to satisfy any licensing concerns; this URL is put into the title attribute, rather than in the usual way as a link from the image, to avoid [[WP:ACCESSIBILITY|accessibility]] problems by visually impaired readers. This behavior can be overridden with the {{para|alt}}, {{para|link}}, and {{para|title}} parameters as described below.
 
* {{para|alt|<var>Text</var>}} specifies the alt text for the image, for visually impaired readers.  The default is empty. If {{para|link|File:}} is specified, the alt text should describe the image's visual appearance; if some other nonempty link target is specified, the alt text should describe the function of the image, not its visual appearance. For more, please see ''[[Wikipedia:Alternative text for images]]''.
* {{para|link|<var>Target</var>}} specifies the link target for the image. The default is empty, which means the image does not link to anything. A target of <code>File:</code> means that the image links to its file page. The target can be the name of a Wikipedia page, and it can be a URL. Normally the target should not also be a target of the adjacent text, as that would be [[WP:OVERLINKING|overlinking]]. If a nonempty link is specified, nonempty {{para|alt}} should also be specified.
* {{para|title|<var>Text</var>}} specifies the title text for the image, which is typically displayed as [[tooltip]] with graphical browsers. It defaults to empty, except that to support historical usage if an image is specified and neither {{para|alt}} nor {{para|link}} are specified, it defaults to the URL of the file page for the image as described above. To suppress this historical usage, specify {{{link|}}} or {{{title|}}} with empty operands.


===Location===
===Location===
Line 24: Line 28:
| {{portal|Science}}
| {{portal|Science}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg}}</pre></small>
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg}}
| {{portal|Spaceflight|RocketSunIcon.svg|link=}}
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
}}
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
|title=Explore space!
}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
|title=Explore space!
}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|size=50}}</pre></small>
| <small><pre>{{portal|Science|size=15}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|size=50}}
| {{portal|Science|size=15}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|boxsize=50}}</pre></small>
| <small><pre>{{portal|Science|boxsize=50}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|boxsize=50}}
| {{portal|Science|boxsize=50}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|break=yes}}</pre></small>
| <small><pre>{{portal|Science|break=yes}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|break=yes}}
| {{portal|Science|break=yes}}
|-
|-
| <small><pre>{{portal|Spaceflight|RocketSunIcon.svg|break=yes|left=yes}}</pre></small>
| <small><pre>{{portal|Science|break=yes|left=yes}}</pre></small>
| {{portal|Spaceflight|RocketSunIcon.svg|break=yes|left=yes}}
| {{portal|Science|break=yes|left=yes}}
|}
|}



Revision as of 22:02, 6 November 2009

This template is used to produce a link in a box to a portal.

Optional parameters

{{portal|name|image|size|boxsize|break=yes|left=yes|margin=|alt=Alt text|link=Link}}

The units assumed for size (the width of the image) and boxsize (the width of the box containing the image and portal link) are pixels (px). By default, the box is surrounded by a margin of width 0.5em, but this can be customized using margin=top right bottom left (e.g. margin=0.25em 0 0.25em 0.25em) or removed using margin=0 (zero).

By default the image is assumed to be purely decorative in the W3C sense that it conveys no significant information other than what is in the adjacent text and nothing should happen when you click on it. No alt text is generated for the image, and the image does not link to anything. The image's title attribute contains a URL to the file page, to satisfy any licensing concerns; this URL is put into the title attribute, rather than in the usual way as a link from the image, to avoid accessibility problems by visually impaired readers. This behavior can be overridden with the |alt=, |link=, and |title= parameters as described below.

  • |alt=Text specifies the alt text for the image, for visually impaired readers. The default is empty. If |link=File: is specified, the alt text should describe the image's visual appearance; if some other nonempty link target is specified, the alt text should describe the function of the image, not its visual appearance. For more, please see Wikipedia:Alternative text for images.
  • |link=Target specifies the link target for the image. The default is empty, which means the image does not link to anything. A target of File: means that the image links to its file page. The target can be the name of a Wikipedia page, and it can be a URL. Normally the target should not also be a target of the adjacent text, as that would be overlinking. If a nonempty link is specified, nonempty |alt= should also be specified.
  • |title=Text specifies the title text for the image, which is typically displayed as tooltip with graphical browsers. It defaults to empty, except that to support historical usage if an image is specified and neither |alt= nor |link= are specified, it defaults to the URL of the file page for the image as described above. To suppress this historical usage, specify or with empty operands.

Location

Within articles, this template is meant to be placed at the bottom of the article in the "See also" section.

Examples

Code
Result
{{portal}}
{{portal|Science}}
{{portal|Spaceflight|RocketSunIcon.svg|link=}}
{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
}}
{{portal|Spaceflight|RocketSunIcon.svg|link=Special:Search
|alt=Search spaceflight portal
|title=Explore space!
}}
{{portal|Science|size=15}}
{{portal|Science|boxsize=50}}
{{portal|Science|break=yes}}
{{portal|Science|break=yes|left=yes}}

See also