]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/ikiwiki/directive/meta.mdwn
clarify what date fields do, following [[bugs/invalid_meta_date_or_updated_not_diagno...
[git.ikiwiki.info.git] / doc / ikiwiki / directive / meta.mdwn
1 The `meta` directive is supplied by the [[!iki plugins/meta desc=meta]] plugin.
3 This directive allows inserting arbitrary metadata into the source of a page.
4 Enter the metadata as follows:
6         \[[!meta field="value"]]
7         \[[!meta field="value" param="value" param="value"]]
9 The first form sets a given field to a given value, while the second form
10 also specifies some additional sub-parameters. You can have only one field
11 per `meta` directive, use more directives if you want to specify more fields.
13 The field values are treated as HTML entity-escaped text, so you can include
14 a quote in the text by writing `"` and so on.
16 ## Supported fields
18 * title
20   Overrides the title of the page, which is generally the same as the
21   page name.
23   Note that if the title is overridden, a "title_overridden" variable will
24   be set to a true value in the template; this can be used to format things
25   differently in this case.
27   An optional `sortas` parameter will be used preferentially when
28   [[ikiwiki/pagespec/sorting]] by `meta(title)`:
30         \[[!meta title="The Beatles" sortas="Beatles, The"]]
32         \[[!meta title="David Bowie" sortas="Bowie, David"]]
34 * license
36   Specifies a license for the page, for example, "GPL". Can contain
37   WikiLinks and arbitrary markup.
39 * copyright
41   Specifies the copyright of the page, for example, "Copyright 2007 by
42   Joey Hess". Can contain WikiLinks and arbitrary markup.
44 * author
46   Specifies the author of a page.
48   An optional `sortas` parameter will be used preferentially when
49   [[ikiwiki/pagespec/sorting]] by `meta(author)`:
51         \[[!meta author="Joey Hess" sortas="Hess, Joey"]]
53 * authorurl
55   Specifies an url for the author of a page.
57 * description
59   Specifies a short description for the page. This will be put in
60   the html header, and can also be displayed by eg, the [[map]] directive.
62 * keywords
64   Specifies keywords summarizing the contents of the page. This
65   information will be put in the html header.  Only letters,
66   numbers, spaces and commas are allowed in this string; other
67   characters are stripped.  Note that the majority of search
68   engines, including Google, do not use information from the
69   keywords header.
71 * permalink
73   Specifies a permanent link to the page, if different than the page
74   generated by ikiwiki.
76 * date
78   Specifies the creation date of the page. This creates a 
79   `<meta name="date" content="...">` header in the HTML output, but also
80   modifies the internal `ctime` in the [[internal index|tips/inside_dot_ikiwiki/]].
81   The date can be entered in nearly any format, since it's parsed by
82   [[!cpan TimeDate]] but invalid dates yield an error in 3.20180321
83   or later.
85 * stylesheet
87   Adds a stylesheet to a page. The stylesheet is treated as a wiki link to
88   a `.css` file in the wiki, so it cannot be used to add links to external
89   stylesheets. Example:
91         \[[!meta stylesheet=somestyle rel="alternate stylesheet"
92         title="somestyle"]]
93   
94   However, this will be scrubbed away if the 
95   [[!iki plugins/htmlscrubber desc=htmlscrubber]] plugin is enabled,
96   since it can be used to insert unsafe content.
98 * script
100   Adds a script to a page. The script is treated as a wiki link to
101   a `.js` file in the wiki, so it cannot be used to add links to external
102   scripts. The optional `defer` and `async` keywords can be used to set
103   the corresponding HTML4 and HTML5 script options. Example:
105         \[[!meta script=somescript defer async]]
107   The tag is subject to scrubbing as with the stylesheet and link fields.
109 * openid
111   Adds html &lt;link&gt; tags to perform OpenID delegation to an external
112   OpenID server. This lets you use an ikiwiki page as your OpenID.
114   By default this will delegate for both `openid` and `openid2`. To only
115   delegate for one, add a parameter such as `delegate=openid`.
117   An optional `xrds-location`
118   parameter lets you specify the location of any [eXtensible Resource
119   DescriptorS](http://www.windley.com/archives/2007/05/using_xrds.shtml).
121   Example:
123         \[[!meta openid="http://joeyh.myopenid.com/"
124         server="http://www.myopenid.com/server"
125         xrds-location="http://www.myopenid.com/xrds?username=joeyh.myopenid.com"]]
127 * link
129   Specifies a link to another page. This can be used as a way to make the
130   wiki treat one page as linking to another without displaying a user-visible
131   [[ikiwiki/WikiLink]]:
133        \[[!meta link=otherpage]]
135   It can also be used to insert a html &lt;link&gt; tag. For example:
137        \[[!meta link="http://joeyh.myopenid.com/" rel="openid.delegate"]]
139   However, this latter syntax won't be allowed if the 
140   [[!iki plugins/htmlscrubber desc=htmlscrubber]] plugin is enabled, since it can be used to
141   insert unsafe content.
143 * enclosure
145   Specifies a link to a file to be rendered as an "enclosure" in
146   RSS/Atom feeds (and a plain old link in HTML). Useful for
147   [[!iki podcast desc=podcasting]].
149 * redir
151   Causes the page to redirect to another page in the wiki.
153         \[[!meta redir=otherpage]]
155   The default is to redirect without delay.
156   Optionally, a delay (in seconds) can be specified: "delay=10"
158   It can also be used to redirect to an external url. For example:
160         \[[!meta redir="http://example.com/"]]
162   However, this latter syntax won't be allowed if the 
163   [[!iki plugins/htmlscrubber desc=htmlscrubber]] plugin is enabled, since it can be used to
164   insert unsafe content.
166   For both cases, an anchor to jump to inside the destination page may also be
167   specified using the common `#ANCHOR` syntax.
169 * robots
171   Causes the robots meta tag to be written:
173         \[[!meta robots="index, nofollow"]]
175   Valid values for the attribute are: "index", "noindex", "follow", and
176   "nofollow". Multiple comma-separated values are allowed, but obviously only
177   some combinations make sense. If there is no robots meta tag, "index,
178   follow" is used as the default.
180   The value is escaped, but its contents are not otherwise checked.
182 * guid
184   Specifies a globally unique ID for a page. This guid should be a URI,
185   and it will be used to identify the page's entry in RSS
186   and Atom feeds. If not given, the default is to use the page's URL as its
187   guid.
189   This is mostly useful when a page has moved, to keep the guids for
190   pages unchanged and avoid flooding aggregators
191   (see [[!iki tips/howto_avoid_flooding_aggregators]]).
193 * updated
195   Specifies a fake modification time for a page, to be output into RSS and
196   Atom feeds. This is useful to avoid flooding aggregators that sort by
197   modification time, like Planet: for instance, when editing an old blog post
198   to add tags, you could set `updated` to be one second later than the original
199   value. The date/time can be given in any format that
200   [[!cpan TimeDate]] can understand, just like the `date` field and maps to the
201   `<meta name="updated" content="...">` HTML header and internal `mtime` field.
203 * foaf
205   Adds a Friend of a Friend ([FOAF](http://wiki.foaf-project.org/w/Autodiscovery))
206   reference to a page.
208   Example:
210         \[[!meta foaf=foaf.rdf]]
212 * name
214   Adds a HTML `<meta>` header with this `name` attribute. Its other attributes are
215   taken from the other parameters, so for example
216   `\[[!meta name="foo" content="bar" x-non-standard-attribute="baz"]]`
217   becomes `<meta name="foo" content="bar" x-non-standard-attribute="baz">`. This
218   won't be allowed if the [[!iki plugins/htmlscrubber desc=htmlscrubber]] plugin is enabled,
219   since it can be used to insert unsafe content.
221 ## Other fields
223 If the field is not one of the above predefined fields, the metadata will be
224 written to the generated html page as a &lt;meta&gt; header. For example,
225 `\[[!meta foo="bar"]]` becomes `<meta name="foo" content="bar">`. As
226 with `name`, this won't be allowed if the [[!iki plugins/htmlscrubber
227 desc=htmlscrubber]] plugin is enabled.
229 This syntax cannot be used for meta headers with unusual names, in
230 particular names containing `:` such as `flattr:id` and `twitter:card`.
231 Please use `\[[!meta name="..." content="..."]]` for those headers.
233 [[!meta robots="noindex, follow"]]