Allow dots in parameter key names
[ikiwiki] / doc / ikiwiki / directive / meta / discussion.mdwn
1 Is there any reason the [language attribute](https://en.wikipedia.org/wiki/Meta_element#The_language_attribute) is not supported?
2 --[[LucaCapello]]
3
4 > Attached a patch against the Git repository, working on Debian ikiwiki_3.20100815.9. --[[LucaCapello]]
5
6 [[patch]]
7
8 -----
9
10 <pre>
11 From 680e57fd384b65e289d92054835687f3d6f3a19d Mon Sep 17 00:00:00 2001
12 From: Luca Capello <luca@pca.it>
13 Date: Sat, 6 Oct 2012 14:11:19 +0200
14 Subject: [PATCH] IkiWiki/Plugin/meta.pm: support the language attribute
15
16 ---
17  IkiWiki/Plugin/meta.pm          |    9 +++++++++
18  doc/ikiwiki/directive/meta.mdwn |    4 ++++
19  2 files changed, 13 insertions(+)
20
21 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
22 index 421f1dc..1a49f0c 100644
23 --- a/IkiWiki/Plugin/meta.pm
24 +++ b/IkiWiki/Plugin/meta.pm
25 @@ -102,6 +102,10 @@ sub preprocess (@) {
26                 $pagestate{$page}{meta}{description}=$value;
27                 # fallthrough
28         }
29 +       elsif ($key eq 'language') {
30 +               $pagestate{$page}{meta}{language}=$value;
31 +               # fallthrough
32 +       }
33         elsif ($key eq 'guid') {
34                 $pagestate{$page}{meta}{guid}=$value;
35                 # fallthrough
36 @@ -279,6 +283,11 @@ sub preprocess (@) {
37                 push @{$metaheaders{$page}}, '<meta name="'.$key.
38                         '" content="'.encode_entities($value).'" />';
39         }
40 +       elsif ($key eq 'language') {
41 +               push @{$metaheaders{$page}},
42 +                       '<meta http-equiv="Content-Language" content="'.
43 +                       encode_entities($value).'" />';
44 +       }
45         elsif ($key eq 'name') {
46                 push @{$metaheaders{$page}}, scrub('<meta name="'.
47                         encode_entities($value).
48 diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn
49 index 984f685..b82fa58 100644
50 --- a/doc/ikiwiki/directive/meta.mdwn
51 +++ b/doc/ikiwiki/directive/meta.mdwn
52 @@ -59,6 +59,10 @@ Supported fields:
53    Specifies a short description for the page. This will be put in
54    the html header, and can also be displayed by eg, the [[map]] directive.
55  
56 +* language
57 +
58 +  Specifies the natural language for the page, for example, "en".
59 +
60  * keywords
61  
62    Specifies keywords summarizing the contents of the page. This
63 -- 
64 1.7.10.4
65 </pre>
66
67 ----
68
69 I guess patching [[/ikiwiki/directive/meta]] to document the fact this attribute is supported would be good. — [[Jon]]