sub titlepage ($) { #{{{
my $title=shift;
$title=~y/ /_/;
- $title=~s/([^-[:alnum:]_:+\/.])/"__".ord($1)."__"/eg;
+ # Note: [:alnum:] is not used here, on purpose; unicode
+ # not allowed in urls.
+ $title=~s/([^-A-Za-z0-9_:+\/.])/"__".ord($1)."__"/eg;
return $title;
} #}}}
$template->param(title => $params{title})
if defined $params{title} && length($params{title});
$template->param(content => htmlescape(htmlabs($params{content}, $feed->{feedurl})));
- $template->param(url => $feed->{url});
$template->param(name => $feed->{name});
- $template->param(link => urlabs($params{link}, $feed->{feedurl}))
+ $template->param(permalink => urlabs($params{link}, $feed->{feedurl}))
if defined $params{link};
if (ref $feed->{tags}) {
$template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]);
$itemtemplate->param(
title => pagetitle(basename($p)),
url => "$config{url}/$renderedfiles{$p}",
+ permalink => "$config{url}/$renderedfiles{$p}",
pubdate => date_822($pagectime{$p}),
content => absolute_urls(get_inline_content($p, $page), $url),
);
shift->(page => $p, destpage => $page,
template => $itemtemplate);
});
+
$content.=$itemtemplate->output;
$itemtemplate->clear_params;
}
pageurl => $url,
content => $content,
);
-
run_hooks(pagetemplate => sub {
shift->(page => $page, destpage => $page,
template => $template);
my %meta;
my %title;
+my %permalink;
+my %author;
sub import { #{{{
IkiWiki::hook(type => "preprocess", id => "meta",
elsif ($key eq 'title') {
$title{$page}=$value;
}
+ elsif ($key eq 'permalink') {
+ $permalink{$page}=$value;
+ }
else {
$meta{$page}.="<meta name=\"".encode_entities($key).
"\" content=\"".encode_entities($value)."\" />\n";
+ if ($key eq 'author') {
+ $author{$page}=$value;
+ }
}
return "";
if exists $meta{$page} && $template->query(name => "meta");
$template->param(title => $title{$page})
if exists $title{$page} && $template->query(name => "title");
+ $template->param(permalink => $permalink{$page})
+ if exists $permalink{$page} && $template->query(name => "permalink");
+ $template->param(author => $author{$page})
+ if exists $author{$page} && $template->query(name => "author");
+
} # }}}
1
the current support is a crude hack due to limitations of XML::Feed:
xml:base is not supported, neither is Content-Location. And of course,
relative links in RSS feeds are ill-undefined..
-
- -- Joey Hess <joeyh@debian.org> Thu, 3 Aug 2006 17:29:51 -0400
+ * Make aggregator save permalinks and author name to pages as metadata.
+ * Add permalink and author support to meta plugin, affecting RSS feeds
+ and blog pages.
+ * Change titlepage() to encode utf-8 alnum characters. This is necessary
+ to avoid UTF-8 creeping into filenames in urls. (There are still
+ some other ways that it can get in.)
+
+ -- Joey Hess <joeyh@debian.org> Thu, 3 Aug 2006 18:45:36 -0400
ikiwiki (1.15) unstable; urgency=low
Specifies the author of a page.
+* permalink
+
+ Specifies the permalink to the page, for use in RSS feeds.
+
If the field is not treated specially (as the link and title fields are),
the metadata will be written to the generated html page as a <meta>
header.
* Still need to support feed expiry.
-* Need to store page author metadata and include it in the rss feed.
- Permalink to? Also, that stuff could be presented better in the html blog
- view, also using the metadata.
<TMPL_VAR CONTENT>
-<p>
-<i>
-From <a href="<TMPL_VAR URL>"><TMPL_VAR NAME></a>
-<TMPL_IF NAME="LINK">
-; <a href="<TMPL_VAR LINK>">permalink</a>
-</TMPL_IF>
-</i>
-</p>
+<br/>
<TMPL_LOOP NAME="TAGS">
[[tag <TMPL_VAR TAG>]]
</TMPL_LOOP>
<TMPL_IF NAME="TITLE">
[[meta title="<TMPL_VAR NAME="TITLE" ESCAPE=HTML>"]]
</TMPL_IF>
+<TMPL_IF NAME="PERMALINK">
+[[meta permalink="<TMPL_VAR NAME="PERMALINK" ESCAPE=HTML>"]]
+</TMPL_IF>
+[[meta author="<TMPL_VAR NAME="NAME" ESCAPE=HTML>"]]
<span class="pageinfo">
Posted <TMPL_VAR CTIME>
+<TMPL_IF NAME="AUTHOR">
+by <TMPL_VAR NAME=AUTHOR>
+</TMPL_IF>
+<TMPL_IF NAME="PERMALINK">
+(<a href="<TMPL_VAR NAME=PERMALINK>">permalink</a>)
+</TMPL_IF>
</span>
<span class="tags">
<item>
+ <TMPL_IF NAME="AUTHOR">
+ <title><TMPL_VAR AUTHOR ESCAPE=HTML>: <TMPL_VAR TITLE ESCAPE=HTML></title>
+ <dc:creator><TMPL_VAR AUTHOR ESCAPE=HTML></dc:creator>
+ <TMPL_ELSE>
<title><TMPL_VAR TITLE ESCAPE=HTML></title>
+ </TMPL_IF>
<guid><TMPL_VAR URL></guid>
- <link><TMPL_VAR URL></link>
+ <link><TMPL_VAR PERMALINK></link>
<TMPL_IF NAME="CATEGORIES">
<TMPL_LOOP NAME="CATEGORIES">
- <category><TMPL_VAR NAME=CATEGORY></category>
+ <category><TMPL_VAR CATEGORY></category>
</TMPL_LOOP>
</TMPL_IF>
<pubDate><TMPL_VAR PUBDATE></pubDate>
<?xml version="1.0"?>
-<rss version="2.0">
+<rss version="2.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><TMPL_VAR TITLE ESCAPE=HTML></title>
<link><TMPL_VAR PAGEURL></link>