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>"]]
$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;
}
Details:
The template page can also contain [[!cpan HTML::Template]] directives,
-like other ikiwiki [[templates]]. Currently only one variable is
-set: `<TMPL_VAR name>` is replaced with the name of the page being
-created.
+like other ikiwiki [[templates]].
+
+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"]]