webgen logo

webgen / static website generator

static website generation made easy!

Latest news

2007-12-31: Minor release with feature enhancements. More...

2007-09-08: Small bug fix release. More...

2007-06-29: Some bug fixes and one small feature enhancement. More...

Links

Generated by webgen

General Information

Plugin name:Tag/Download (Tag/Default)
Author:Thomas Leitner <t_leitner@gmx.at>
Summary:Provides a nice download link and, optional, image
Dependencies:Core/ResourceManager
Parameters:

alwaysShowDownloadIconfalse
Specifies if the download icon should always be shown, or only when no icon is available for the file type.

iconnil
The URL to an icon which will be shown next to the name.

mappingFilenil
An additional mapping file used for mapping extensions to icons.

url (=default mandatory parameter): nil
The URL to the file. Can be a local file or one referenced via HTTP/FTP.

Handled tags:download

Description

This tag is used to provide a nice download link. The download link includes the following parts:

  • download icon [optional]: an icon which shows that the file can be downloaded
  • file icon: an icon showing the type of the file (PDF file, music file, video file,...)
  • link to file: the link to the file
  • file size: the size of the file if it can be calculated

Caveat: You should link to the webgen-css resource in your template as this plugin defines some CSS styles!

Format of mapping file

You can specify additional type-to-icon mappings using the parameter mappingFile which needs to point to a file with the mappings. The format for the file is YAML and following is an example:

file-mapping:
    /images/mytype.jpg: [.my, .mytype]
    /images/documents.jpg: [.wpd, .doc, .sxw, .odt, .rtf]

resource-mapping:
    webgen-icons-text: [.page, .template]

The two possible top level keys are file-mapping and resource-mapping. The first specifies which image file and the second which resource should be used for the specified extensions.

Examples

UsageOutput
{download: {url: /images/thumb_example.jpg}} File iconthumb_example.jpg (32.44 KiB)
{download: {url: /images/thumb_example.jpg, alwaysShowDownloadIcon: true}} Download iconFile iconthumb_example.jpg (32.44 KiB)
{download: download.page} Download icondownload.page (1.83 KiB)