Template:PDFlink

From Meta, a Wikimedia project coordination wiki

DocumentPDF

Template documentation

Purpose[edit]

Highlighting that a link points to a PDF document (on some systems PDF files may take time to download and display within the browser, and their use on many websites is not compliant with the w:Web Content Accessibility Guidelines).

Usage[edit]

The following lines:

{{PDFlink|[https://www.example.com/Link.pdf Link]}}
{{PDFlink|[https://www.example.com/Link.pdf Link]|32 [[KiB]]}}

yield:

LinkPDF
LinkPDF (32 KiB)

Note: It was previously possible to add the icon with {{PDFlink}} by itself, but the functionality has been changed and this no longer works in Internet Explorer. You must surround it with the template as shown above.

Limitations[edit]

As the template uses unnamed parameters, links containing = or | will cause the link to not display at all. The workarounds to this limitation are to replace the entity with an indirect character reference as = and |, respectively, or to use the numbered parameter (1= and 2=) for each parameter to take care of =, or to use the magic words {{=}} and {{!}} to take care of = and | respectively.

Examples[edit]

  • {{PDFlink|[https://www.example.com/bla?a=xy|Link.pdf Link to a PDF]|32KB}}

32KBPDF

  • {{PDFlink|[https://www.example.com/bla?a=xy|Link.pdf Link to a PDF]|32KB}}

Link to a PDFPDF (32KB)

  • {{PDFlink|1=[https://www.example.com/bla?a=xy{{!}}Link.pdf Link to a PDF]|2=32KB}}

Link to a PDFPDF (32KB)

TemplateData[edit]

This template formats a link pointing to a PDF document with a PDF icon, and includes an explanatory link about the PDF file format.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
link1

The link to the PDF document, using full link syntax

Example
[https://example.org/document.pdf Document]
Contentrequired
note2

Additional note, appears after the explanatory link about PDF

Contentoptional