diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-30 13:38:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-04-01 14:39:27 -0400 |
commit | 89df287aaa0a21d959dc2c179412a16ab08a7d51 (patch) | |
tree | 8187df956c8682e75bdae2a602847661f1176abe | |
parent | 0cd67c515fad03797fa7792c10b507a0abb77c28 (diff) | |
download | ikiwiki-89df287aaa0a21d959dc2c179412a16ab08a7d51.tar ikiwiki-89df287aaa0a21d959dc2c179412a16ab08a7d51.tar.gz |
meta: Support keywords header. Closes: #664780 Thanks, Martin Michlmayr
-rw-r--r-- | IkiWiki/Plugin/meta.pm | 7 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rw-r--r-- | doc/ikiwiki/directive/meta.mdwn | 9 |
3 files changed, 18 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 28b1a1ad6..b19ea2b32 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -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="'. diff --git a/debian/changelog b/debian/changelog index 861679b4e..ca1f92116 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn index f8494dbff..984f68540 100644 --- a/doc/ikiwiki/directive/meta.mdwn +++ b/doc/ikiwiki/directive/meta.mdwn @@ -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 |