From: Simon McVittie Date: Mon, 5 Apr 2010 23:58:55 +0000 (+0100) Subject: Only store titlesort in meta pagestate if it differs from title X-Git-Tag: 3.20100427~203^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=be1d97c0bd495fe876853d7d7f6eb42041867649;p=ikiwiki.git Only store titlesort in meta pagestate if it differs from title --- diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 553f93455..7f19b46a3 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -88,13 +88,18 @@ sub preprocess (@) { # Metadata collection that needs to happen during the scan pass. if ($key eq 'title') { - $pagestate{$page}{meta}{title}=HTML::Entities::encode_numeric($value); + my $encoded = HTML::Entities::encode_numeric($value); + $pagestate{$page}{meta}{title} = $encoded; + if (exists $params{sortas}) { $pagestate{$page}{meta}{titlesort}=$params{sortas}; } - else { + elsif ($encoded ne $value) { $pagestate{$page}{meta}{titlesort}=$value; } + else { + delete $pagestate{$page}{meta}{titlesort}; + } return ""; } elsif ($key eq 'description') {