From: joey Date: Mon, 20 Mar 2006 19:56:37 +0000 (+0000) Subject: added last changed timestamp for pages X-Git-Tag: 1.0~287 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b7c86dda2f900dc991d1f6becda56ba3300cccce;p=ikiwiki.git added last changed timestamp for pages --- diff --git a/doc/todo.mdwn b/doc/todo.mdwn index 996a1535b..3e2374a4f 100644 --- a/doc/todo.mdwn +++ b/doc/todo.mdwn @@ -121,8 +121,4 @@ A cgi page to allow a user to log out and to edit their prefs, including passwor ikiwiki needs a logo. I'm thinking something simple like the word "ikiwiki" with the first "k" backwards; drawn to show that it's "wiki" reflected. -## Page last-changed timestamps - -Of course you can go to the history to see when a page last changed in svn, still, it will be nice to have a timestamp at the bottom of pages. Should be based on the modification date of the source file, not the last rebuild date. - ## [[Bugs]] diff --git a/ikiwiki b/ikiwiki index d1a31eb55..167b9d43a 100755 --- a/ikiwiki +++ b/ikiwiki @@ -324,9 +324,10 @@ sub indexlink () { #{{{ return "$config{wikiname}"; } #}}} -sub finalize ($$) { #{{{ +sub finalize ($$$) { #{{{ my $content=shift; my $page=shift; + my $mtime=shift; my $title=basename($page); $title=~s/_/ /g; @@ -354,6 +355,7 @@ sub finalize ($$) { #{{{ content => $content, backlinks => [backlinks($page)], discussionlink => htmllink($page, "Discussion", 1, 1), + mtime => scalar(gmtime($mtime)), ); return $template->output; @@ -385,7 +387,8 @@ sub render ($) { #{{{ $content=linkify($content, $page); $content=htmlize($type, $content); - $content=finalize($content, $page); + $content=finalize($content, $page, + mtime("$config{srcdir}/$file")); check_overwrite("$config{destdir}/".htmlpage($page), $page); writefile("$config{destdir}/".htmlpage($page), $content); diff --git a/templates/page.tmpl b/templates/page.tmpl index 5bd71dd2f..141d86a10 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -35,7 +35,10 @@

+

+last edited +