]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge remote-tracking branch 'origin/master'
authorSimon McVittie <smcv@debian.org>
Mon, 30 Nov 2015 21:02:07 +0000 (21:02 +0000)
committerSimon McVittie <smcv@debian.org>
Mon, 30 Nov 2015 21:02:07 +0000 (21:02 +0000)
IkiWiki/Plugin/pagestats.pm
doc/ikiwiki/directive/pagestats.mdwn

index 460a5969a60e6924af3f637db2c3760e8883e7ae..ac0a463e3ff65814ac001c6214598bd4b0f8dc18 100644 (file)
@@ -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{show} &&
+               exists $pagestate{$page} &&
+               exists $pagestate{$page}{meta}{$params{show}}) {
+               return $pagestate{$page}{meta}{$params{show}};
+       }
+       else {
+               return undef;
+       }
+}
+
 sub preprocess (@) {
        my %params=@_;
        $params{pages}="*" unless defined $params{pages};
@@ -84,7 +97,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).
@@ -107,7 +120,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';
 
index 8d2be09469ccd964b34d971d42939ec973a82b73..ab8397366f985a8604236c597ba8814c8b3aaf01 100644 (file)
@@ -40,4 +40,10 @@ that name still works, if its value is numeric.
 The optional `class` parameter can be used to control the class
 of the generated tag cloud `div` or page stats `table`.
 
+By default, the names of pages are shown. The `show` parameter
+can be used (with a non-numeric value) to show the titles or descriptions
+of pages instead (as set by the [[meta]] directive). For example:
+
+       \[[!pagestats pages="tags/*" show="title"]]
+
 [[!meta robots="noindex, follow"]]