add Git patch
[ikiwiki.git] / 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 -----
7
8 <pre>
9 From 680e57fd384b65e289d92054835687f3d6f3a19d Mon Sep 17 00:00:00 2001
10 From: Luca Capello <luca@pca.it>
11 Date: Sat, 6 Oct 2012 14:11:19 +0200
12 Subject: [PATCH] IkiWiki/Plugin/meta.pm: support the language attribute
13
14 ---
15  IkiWiki/Plugin/meta.pm          |    9 +++++++++
16  doc/ikiwiki/directive/meta.mdwn |    4 ++++
17  2 files changed, 13 insertions(+)
18
19 diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
20 index 421f1dc..1a49f0c 100644
21 --- a/IkiWiki/Plugin/meta.pm
22 +++ b/IkiWiki/Plugin/meta.pm
23 @@ -102,6 +102,10 @@ sub preprocess (@) {
24                 $pagestate{$page}{meta}{description}=$value;
25                 # fallthrough
26         }
27 +       elsif ($key eq 'language') {
28 +               $pagestate{$page}{meta}{language}=$value;
29 +               # fallthrough
30 +       }
31         elsif ($key eq 'guid') {
32                 $pagestate{$page}{meta}{guid}=$value;
33                 # fallthrough
34 @@ -279,6 +283,11 @@ sub preprocess (@) {
35                 push @{$metaheaders{$page}}, '<meta name="'.$key.
36                         '" content="'.encode_entities($value).'" />';
37         }
38 +       elsif ($key eq 'language') {
39 +               push @{$metaheaders{$page}},
40 +                       '<meta http-equiv="Content-Language" content="'.
41 +                       encode_entities($value).'" />';
42 +       }
43         elsif ($key eq 'name') {
44                 push @{$metaheaders{$page}}, scrub('<meta name="'.
45                         encode_entities($value).
46 diff --git a/doc/ikiwiki/directive/meta.mdwn b/doc/ikiwiki/directive/meta.mdwn
47 index 984f685..b82fa58 100644
48 --- a/doc/ikiwiki/directive/meta.mdwn
49 +++ b/doc/ikiwiki/directive/meta.mdwn
50 @@ -59,6 +59,10 @@ Supported fields:
51    Specifies a short description for the page. This will be put in
52    the html header, and can also be displayed by eg, the [[map]] directive.
53  
54 +* language
55 +
56 +  Specifies the natural language for the page, for example, "en".
57 +
58  * keywords
59  
60    Specifies keywords summarizing the contents of the page. This
61 -- 
62 1.7.10.4
63 </pre>