Extension:Attachments

The Attachments extension lets users attach files and external links to pages in enabled namespaces.


 * subpages are automatically attached to their parent page
 * files can be attached to a page with
 * external links can be defined as subpages containing

For enabled namespaces the attachments of an article are displayed in an automatically generated section at its end. To facilitate adding attachments an Attach page action is provided, which is linked in the Vector and Minerva skins.

Tips

 * also works on regular articles.
 * You can link files added through  relatively with   (or   for the parent page).
 * Enable $wgCountCategorizedImagesAsUsed to exclude attached files from Special:UnusedImages.
 * You can exclude subpages starting with a specific prefix from the autoindex with  on the parent page.
 * Attachments and external URLs are both stored as page props, meaning they can be queried with API:Pageprops and API:Pageswithprop.
 * You can access attachments before they are sorted with the  hook, where links is an associative array mapping string keys to HTML links. Return false to take over the sorting.

Installation

 * Uploads need to be enabled and subpages need to be enabled.

It is recommended to set up a job runner.

Configuration parameters

 * $wgAttachmentsNamespaces: Associative array, set a namespace id to true to enable the extension in the namespace.

Credits
This extension is essentially a complete rewrite of PerPageResources by Mathias Ertl, which consists of Extension:Resources, Extension:AddResource and Extension:ExternalRedirects. This extension replaces all three, notable differences are:


 * attachments are stored in page_props instead of pagelinks
 * no open redirects, just links
 * attachments are shown at the end of pages, as opposed to on a special page