summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/meta.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 5f046cb2a..bf8159814 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -13,6 +13,7 @@ sub import {
hook(type => "needsbuild", id => "meta", call => \&needsbuild);
hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1);
hook(type => "pagetemplate", id => "meta", call => \&pagetemplate);
+ hook(type => "sort", id => "meta_title", call => \&sort_meta_title);
}
sub getsetup () {
@@ -282,6 +283,20 @@ sub pagetemplate (@) {
}
}
+sub title {
+ my $title = $pagestate{$_[0]}{meta}{title};
+
+ if (defined $title) {
+ return $title;
+ }
+
+ return pagetitle(IkiWiki::basename($_[0]));
+}
+
+sub sort_meta_title {
+ return title($_[0]) cmp title($_[1]);
+}
+
sub match {
my $field=shift;
my $page=shift;