Jump to content

Template:Selfsubst/now string

From mediawiki.org
Template documentation

This template produces a self-updating time stamp of the last revision. While normal articles or templates can use magic words like {{REVISIONTIMESTAMP}}, those have no effect on scripts or css files that are used in raw form.

Usage

[edit]

Using

var foo = {{subst:Selfsubst/now string|js}};

expands to

var foo = /*/{{subst:Selfsubst/now string|js|/*/ "2024-09-05 15:52:00 (UTC)" /*/}}/*/;

which in turn will, on every page save, substitute to itself with an updated version string.

The first parameter needs to be the language where this timestamp is used. The language determines how the recursive template call is hidden from the surrounding language. Currently, there are the following languages defined: