Provide a UUID in edittemplate templates.
I want to make GUIDs for my RSS feeds that don't change when I move pages around. To that end, I've used UUID::Tiny to generate a version 4 (random) UUID that is presented in a `uuid` variable in the template. At that point, you can do something like this: [[!meta guid="urn:uuid:<TMPL_VAR uuid>"]]master
parent
d5f5313925
commit
7aa10a2952
|
@ -139,6 +139,14 @@ sub filltemplate ($$) {
|
||||||
|
|
||||||
$template->param(name => $page);
|
$template->param(name => $page);
|
||||||
|
|
||||||
|
eval {
|
||||||
|
require UUID::Tiny;
|
||||||
|
UUID::Tiny->import(':std');
|
||||||
|
my $uuid;
|
||||||
|
$uuid = create_uuid_as_string(UUID_V4());
|
||||||
|
$template->param(uuid => $uuid);
|
||||||
|
};
|
||||||
|
|
||||||
return $template->output;
|
return $template->output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,14 @@ something like:
|
||||||
Details:
|
Details:
|
||||||
|
|
||||||
The template page can also contain [[!cpan HTML::Template]] directives,
|
The template page can also contain [[!cpan HTML::Template]] directives,
|
||||||
like other ikiwiki [[templates]]. Currently only one variable is
|
like other ikiwiki [[templates]].
|
||||||
set: `<TMPL_VAR name>` is replaced with the name of the page being
|
|
||||||
created.
|
Two variables might be set:
|
||||||
|
|
||||||
|
* `<TMPL_VAR name>` is replaced with the name of the page being
|
||||||
|
created.
|
||||||
|
|
||||||
|
* `<TMPL_VAR uuid>` is replaced with a version 4 (random) UUID.
|
||||||
|
(Requires the `UUID::Tiny` Perl module.)
|
||||||
|
|
||||||
[[!meta robots="noindex, follow"]]
|
[[!meta robots="noindex, follow"]]
|
||||||
|
|
Loading…
Reference in New Issue