+"""]]
+
+I eventually managed to get something that suits me, for the problem described above (I want [[ikiwiki/directive/pagestats]] directive to display [[title|ikiwiki/directive/meta]] rather than page name).
+
+Here is a [[patch]] that adds an option `disp` for the [[ikiwiki/directive/pagestats]], acting exactly the same as option `show` for the [[ikiwiki/directive/map]] directive (but parameter `show` was already used for something else). That is, if one wants its tags displayed using their [[title|ikiwiki/directive/meta]] rather than their page name, she can use param `disp`, is in:
+
+ \[[!pagestats pages="tags/*" disp=title]]
+
+[[!toggle id=patch text="Patch"]]
+[[!toggleable id=patch text="""
+ diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm
+ index 17b26f7..8a5e100 100644
+ --- a/IkiWiki/Plugin/pagestats.pm
+ +++ b/IkiWiki/Plugin/pagestats.pm
+ @@ -31,6 +31,19 @@ sub getsetup () {
+ },
+ }
+
+ +sub linktext ($%) {
+ + # Return the text of the link to a tag, depending on option linktext.
+ + my ($page, %params) = @_;
+ + if (exists $params{disp} &&
+ + exists $pagestate{$page} &&
+ + exists $pagestate{$page}{meta}{$params{disp}}) {
+ + return $pagestate{$page}{meta}{$params{disp}};
+ + }
+ + else {
+ + return undef;
+ + }
+ +}
+ +
+ sub preprocess (@) {
+ my %params=@_;
+ $params{pages}="*" unless defined $params{pages};
+ @@ -78,7 +91,7 @@ sub preprocess (@) {
+ return "<table class='".(exists $params{class} ? $params{class} : "pageStats")."'>\n".
+ join("\n", map {
+ "<tr><td>".
+ - htmllink($params{page}, $params{destpage}, $_, noimageinline => 1).
+ + htmllink($params{page}, $params{destpage}, $_, noimageinline => 1, linktext => linktext($_, %params)).
+ "</td><td>".$counts{$_}."</td></tr>"
+ }
+ sort { $counts{$b} <=> $counts{$a} } keys %counts).
+ @@ -101,7 +114,7 @@ sub preprocess (@) {
+
+ $res.="<li>" if $style eq 'list';
+ $res .= "<span class=\"$class\">".
+ - htmllink($params{page}, $params{destpage}, $page).
+ + htmllink($params{page}, $params{destpage}, $page, linktext => linktext($page, %params)).
+ "</span>\n";
+ $res.="</li>" if $style eq 'list';
+
+"""]]
+
+Regards,
+-- [[Louis|spalax]]
+
+> Saved to my git repository as `contrib/spalax/pagestats-disp`.
+> I'd rather find a better name than `disp` for the parameter.
+> I think `display` would be an improvement, but that doesn't solve the
+> problem of "it's a synonym for show, and non-obvious which is which".
+> Maybe `linktext`?
+>
+> It's unfortunate that `map` and `pagestats` have different meanings for
+> the `show` parameter. I'm tempted to propose a patch that adds something
+> like `limit` (by analogy with SQL) or `max` as the canonical name for the
+> "number of things to match" parameter, at which point a non-numeric
+> `show` could mean this thing. --[[smcv]]
+
+>> [[!template id=gitbranch branch=smcv/pagestats-show
+author="[[Louis|spalax]], [[smcv]]"
+browse=http://git.pseudorandom.co.uk/smcv/ikiwiki.git/shortlog/refs/heads/pagestats-show]]
+>> Here's a branch. It depends on my `ready/limit` branch
+>> from [[todo/pick a new canonical name for equivalent of SQL limit]].
+>> --[[smcv]]