txt: Add a special case for robots.txt.
authorJoey Hess <joey@gnu.kitenet.net>
Mon, 5 Apr 2010 21:02:10 +0000 (17:02 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 5 Apr 2010 21:02:10 +0000 (17:02 -0400)
IkiWiki/Plugin/txt.pm
debian/changelog
doc/plugins/txt.mdwn

index 1ed9f0856fe0d8589aede718651110a228e60a4a..0d9a0b35bd8abf6be895c4d1ce85f64a6077ded1 100644 (file)
@@ -39,7 +39,14 @@ sub filter (@) {
        my %params = @_;
        my $content = $params{content};
 
-       if (defined $pagesources{$params{page}} && $pagesources{$params{page}} =~ /\.txt$/) {
+       if (defined $pagesources{$params{page}} &&
+           $pagesources{$params{page}} =~ /\.txt$/) {
+               if ($pagesources{$params{page}} eq 'robots.txt' &&
+                   $params{page} eq $params{destpage}) {
+                       will_render($params{page}, 'robots.txt');
+                       writefile('robots.txt', $config{destdir}, $content);
+               }
+
                encode_entities($content, "<>&");
                if ($findurl) {
                        my $finder = URI::Find->new(sub {
index be89d0918f3b282c96f1c876e736eb5974a9479d..77d17f56634142eba29174ea35e04889817fb4a3 100644 (file)
@@ -2,6 +2,7 @@ ikiwiki (3.20100404) UNRELEASED; urgency=low
 
   * bzr: Fix bzr log parsing to work with bzr 2.0. (liw)
   * comments: Fix missing entity encoding in title.
+  * txt: Add a special case for robots.txt.
 
  -- Joey Hess <joeyh@debian.org>  Sun, 04 Apr 2010 12:17:11 -0400
 
index 420898d095b2a7e8b8aed8f303da66515eb3d541..a3087c9e036138994df7107933771f8a9df47b68 100644 (file)
@@ -12,3 +12,8 @@ The only exceptions are that [[WikiLinks|ikiwiki/WikiLink]] and
 [[directives|ikiwiki/directive]] are still expanded by
 ikiwiki, and that, if the [[!cpan URI::Find]] perl module is installed, URLs
 in the txt file are converted to hyperlinks.
+
+----
+
+As a special case, a file `robots.txt` will be copied intact into the
+`destdir`, as well as creating a wiki page named "robots".