meta: Support keywords header. Closes: #664780 Thanks, Martin Michlmayr
authorJoey Hess <joey@kitenet.net>
Fri, 30 Mar 2012 17:38:52 +0000 (13:38 -0400)
committerJoey Hess <joey@kitenet.net>
Sun, 1 Apr 2012 18:39:27 +0000 (14:39 -0400)
IkiWiki/Plugin/meta.pm
debian/changelog
doc/ikiwiki/directive/meta.mdwn

index 28b1a1ad6e69624791492a8582dce79360acee89..b19ea2b3294b0e1c985c56162084b5e2430d6398 100644 (file)
@@ -285,6 +285,13 @@ sub preprocess (@) {
                        join(' ', map { "$_=\"$params{$_}\"" } keys %params).
                        ' />', $page, $destpage);
        }
+       elsif ($key eq 'keywords') {
+               # Make sure the keyword string is safe: only allow alphanumeric
+               # characters, space and comma and strip the rest.
+               $value =~ s/[^[:alnum:], ]+//g;
+               push @{$metaheaders{$page}}, '<meta name="keywords"'.
+                       ' content="'.encode_entities($value).'" />';
+       }
        else {
                push @{$metaheaders{$page}}, scrub('<meta name="'.
                        encode_entities($key).'" content="'.
index 861679b4e431a72066f2c2855ba4ebe6fc26790a..ca1f921167b142b1999553ed3019a0822b38499f 100644 (file)
@@ -9,6 +9,8 @@ ikiwiki (3.20120204) UNRELEASED; urgency=low
     changed pages.
   * Added a "changes" hook. Renamed the "change" hook to "rendered", but
     the old hook name is called for now for back-compat.
+  * meta: Support keywords header. Closes: #664780
+    Thanks, Martin Michlmayr
 
  -- Joey Hess <joeyh@debian.org>  Wed, 21 Mar 2012 14:33:14 -0400
 
index f8494dbff685c1486459bbc3798dc7b51370f3c3..984f685402f28993eb7b1a11a761c3430eacd910 100644 (file)
@@ -59,6 +59,15 @@ Supported fields:
   Specifies a short description for the page. This will be put in
   the html header, and can also be displayed by eg, the [[map]] directive.
 
+* keywords
+
+  Specifies keywords summarizing the contents of the page. This
+  information will be put in the html header.  Only letters,
+  numbers, spaces and commas are allowed in this string; other
+  characters are stripped.  Note that the majority of search
+  engines, including Google, do not use information from the
+  keywords header.
+
 * permalink
 
   Specifies a permanent link to the page, if different than the page