+}
+
+sub taglink ($$$;@) {
+ my $page=shift;
+ my $destpage=shift;
+ my $tag=shift;
+ my %opts=@_;
+
+ return htmllink($page, $destpage, tagpage($tag), %opts);
+}
+
+sub gentag ($) {
+ my $tag=shift;
+ if (defined $config{tag_autocreate} && $config{tag_autocreate}) {
+ my $tagfile = newpagefile(tagpage($tag), $config{default_pageext});
+ $tagfile=~s/^\///;
+
+ return if (! add_autofile($tagfile));
+
+ debug(sprintf(gettext("creating tag page %s"), $tag));
+
+ my $template=template("autotag.tmpl");
+ $template->param(tag => $tag);
+ writefile($tagfile, $config{srcdir}, $template->output);
+ }
+}