From c10cfb27d1e15eb3d69923e8aae9e84f3f14926a Mon Sep 17 00:00:00 2001
From: "martin f. krafft" <madduck@madduck.net>
Date: Sun, 2 Mar 2008 15:51:31 +0100
Subject: [PATCH] Add robots tag to meta plugin

Add special handling for <meta name="robots" ...> which needs not be
scrubbed as it's harmless.

Signed-off-by: martin f. krafft <madduck@madduck.net>
(cherry picked from commit b15d0299a7f7b147e89d8a202d6cca1c21491af2)
---
 IkiWiki/Plugin/meta.pm |  4 ++++
 debian/changelog       |  7 ++++++-
 doc/plugins/meta.mdwn  | 15 +++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 74b630afc..2df5a727c 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -193,6 +193,10 @@ sub preprocess (@) { #{{{
 				" />\n");
 		}
 	}
+	elsif ($key eq 'robots') {
+		push @{$metaheaders{$page}}, '<meta name="robots"'.
+			' value="'.encode_entities($value).'" />';
+	}
 	else {
 		push @{$metaheaders{$page}}, scrub('<meta name="'.encode_entities($key).
 			'" content="'.encode_entities($value).'" />');
diff --git a/debian/changelog b/debian/changelog
index bfd3266cb..30416ecdd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,15 @@
 ikiwiki (2.41) UNRELEASED; urgency=low
 
+  [ Adeodato Simó ]
   * Preprocessor directives generated by the shortcut plugin accept a `desc`
     parameter that overrides the anchor text provided at shortcut definition
     time. (Closes: #458126)
 
- -- Adeodato Simó <dato@net.com.org.es>  Sun, 02 Mar 2008 17:19:16 +0100
+  [ martin f. krafft ]
+  * The meta plugin now allows for the robots tag to be specified without the
+    risk of it being scrubbed.
+
+ -- martin f. krafft <madduck@debian.org>  Sun, 02 Mar 2008 17:46:38 +0100
 
 ikiwiki (2.40) unstable; urgency=low
 
diff --git a/doc/plugins/meta.mdwn b/doc/plugins/meta.mdwn
index 0bcd11b67..b503e4511 100644
--- a/doc/plugins/meta.mdwn
+++ b/doc/plugins/meta.mdwn
@@ -103,6 +103,21 @@ Supported fields:
   For both cases, an anchor to jump to inside the destination page may also be
   specified using the common `PAGE#ANCHOR` syntax.
 
+* robots
+
+  Causes the robots meta tag to be written:
+
+        \[[meta robots="index, nofollow"]]
+
+  Valid values for the attribute are: "index", "noindex", "follow", and
+  "nofollow". Multiple comma-separated values are allowed, but obviously only
+  some combinations make sense. If there is no robots meta tag, "index,
+  follow" is used as the default.
+
+  The plugin escapes the value, but otherwise does not care about its
+  contents. In particular, it does not check the values against the set of
+  valid values but serves whatever you pass it.
+
 If the field is not one of the above predefined fields, the metadata will be
 written to the generated html page as a &lt;meta&gt; header. However, this
 won't be allowed if the [[htmlscrubber]] is enabled, since it can be used to
-- 
2.39.5