the numbacklinks setting.
sslcookie => 0,
httpauth => 0,
userdir => "",
+ numbacklinks => 10,
} #}}}
sub checkconfig () { #{{{
calculate_backlinks();
my @links;
- return unless $backlinks{$page};
foreach my $p (keys %{$backlinks{$page}}) {
my $href=abs2rel(htmlpage($p), dirname($page));
push @links, { url => $href, page => pagetitle($p_trimmed) };
}
+ @links = sort { $a->{page} cmp $b->{page} } @links;
- return sort { $a->{page} cmp $b->{page} } @links;
+ return \@links, [] if @links <= $config{numbacklinks};
+ return [@links[0..$config{numbacklinks}-1]],
+ [@links[$config{numbacklinks}..$#links]];
} #}}}
sub parentlinks ($) { #{{{
$template->param(have_actions => 1);
}
+ my ($backlinks, $more_backlinks)=backlinks($page);
+
$template->param(
title => $page eq 'index'
? $config{wikiname}
wikiname => $config{wikiname},
parentlinks => [parentlinks($page)],
content => $content,
- backlinks => [backlinks($page)],
+ backlinks => $backlinks,
+ more_backlinks => $more_backlinks,
mtime => displaytime($mtime),
baseurl => baseurl($page),
);
* Add a popup template in the basewiki. CSS based on some by Martin Krafft.
* Make the note, popup, and plugin templates detect missing variables and be
self-documenting, listing the available variables.
+ * Hide excess backlinks and expand using CSS trick; control quantiy via
+ the numbacklinks setting.
- -- Joey Hess <joeyh@debian.org> Sat, 31 Mar 2007 02:23:46 -0400
+ -- Joey Hess <joeyh@debian.org> Sat, 31 Mar 2007 04:27:08 -0400
ikiwiki (1.48) unstable; urgency=low
width: 25%
}
-/* Used by the popup template. */
+/* Used by the popup template and for backlinks hiding. */
.popup {
border-bottom: 1px dotted #366;
color: #366;
}
.popup .balloon,
-.popup .paren {
+.popup .paren,
+.popup .expand {
display: none;
}
.popup:hover .balloon,
-moz-opacity: 0.95;
filter: alpha(opacity=95);
}
+.popup:hover .expand,
+.popup:focus .expand {
+ display: inline;
+}
Enables or disables "Discussion" links from being added to the header of
every page. The links are enabled by default.
+* --numbacklinks n
+
+ Controls how many backlinks should be displayed maximum. Excess backlinks
+ will be hidden in a popup. Default is 10.
+
* --userdir subdir
Optionally, allows links to users of the wiki to link to pages inside a
"wrappers!" => \$config{wrappers},
"getctime" => \$config{getctime},
"wrappermode=i" => \$config{wrappermode},
+ "numbacklinks=i" => \$config{numbacklinks},
"rcs=s" => \$config{rcs},
"no-rcs" => sub { $config{rcs}="" },
"cgi!" => \$config{cgi},
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-31 02:06-0400\n"
+"POT-Creation-Date: 2007-03-31 04:39-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
#: ../IkiWiki/CGI.pm:418 ../IkiWiki/Plugin/brokenlinks.pm:24
#: ../IkiWiki/Plugin/inline.pm:181 ../IkiWiki/Plugin/opendiscussion.pm:17
-#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:97
-#: ../IkiWiki/Render.pm:165
+#: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:99
+#: ../IkiWiki/Render.pm:170
msgid "discussion"
msgstr ""
msgid "nonexistant template %s"
msgstr ""
-#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:101
+#: ../IkiWiki/Plugin/inline.pm:189 ../IkiWiki/Render.pm:103
msgid "Discussion"
msgstr ""
"notifications"
msgstr ""
-#: ../IkiWiki/Render.pm:249 ../IkiWiki/Render.pm:269
+#: ../IkiWiki/Render.pm:254 ../IkiWiki/Render.pm:274
#, perl-format
msgid "skipping bad filename %s"
msgstr ""
-#: ../IkiWiki/Render.pm:309
+#: ../IkiWiki/Render.pm:314
#, perl-format
msgid "removing old page %s"
msgstr ""
-#: ../IkiWiki/Render.pm:329
+#: ../IkiWiki/Render.pm:334
#, perl-format
msgid "scanning %s"
msgstr ""
-#: ../IkiWiki/Render.pm:339
+#: ../IkiWiki/Render.pm:344
#, perl-format
msgid "rendering %s"
msgstr ""
-#: ../IkiWiki/Render.pm:351
+#: ../IkiWiki/Render.pm:356
#, perl-format
msgid "rendering %s, which links to %s"
msgstr ""
-#: ../IkiWiki/Render.pm:368
+#: ../IkiWiki/Render.pm:373
#, perl-format
msgid "rendering %s, which depends on %s"
msgstr ""
-#: ../IkiWiki/Render.pm:406
+#: ../IkiWiki/Render.pm:411
#, perl-format
msgid "rendering %s, to update its backlinks"
msgstr ""
-#: ../IkiWiki/Render.pm:418
+#: ../IkiWiki/Render.pm:423
#, perl-format
msgid "removing %s, no longer rendered by %s"
msgstr ""
-#: ../IkiWiki/Render.pm:444
+#: ../IkiWiki/Render.pm:449
#, perl-format
msgid "ikiwiki: cannot render %s"
msgstr ""
msgid "usage: ikiwiki [options] source dest"
msgstr ""
-#: ../IkiWiki.pm:103
+#: ../IkiWiki.pm:104
msgid "Must specify url to wiki with --url when using --cgi"
msgstr ""
-#: ../IkiWiki.pm:150 ../IkiWiki.pm:151
+#: ../IkiWiki.pm:151 ../IkiWiki.pm:152
msgid "Error"
msgstr ""
#. translators: preprocessor directive name,
#. translators: the second a page name, the
#. translators: third a number.
-#: ../IkiWiki.pm:573
+#: ../IkiWiki.pm:574
#, perl-format
msgid "%s preprocessing loop detected on %s at depth %i"
msgstr ""
<TMPL_LOOP NAME="BACKLINKS">
<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
</TMPL_LOOP>
+<TMPL_IF NAME="MORE_BACKLINKS">
+<span class="popup">...
+<span class="expand">
+<TMPL_LOOP NAME="MORE_BACKLINKS">
+<a href="<TMPL_VAR NAME=URL>"><TMPL_VAR NAME=PAGE></a>
+</TMPL_LOOP>
+</span>
+</span>
+</TMPL_IF>
</TMPL_IF>
</div>