octopress-multilingual 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/README.md +5 -5
- data/lib/octopress-multilingual.rb +6 -11
- data/lib/octopress-multilingual/jekyll.rb +2 -6
- data/lib/octopress-multilingual/set_lang-tag.rb +4 -19
- data/lib/octopress-multilingual/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3ae15ba4e42285ca409a3e01dad012bbb35df62
|
4
|
+
data.tar.gz: 6bbbd3561ad7f931c11ab9d7020af47e33ac4329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee9d5706021be85b0cb543dec60807388759ffb7394b74884d73c8e4065f139faff613f0f1d4cca24cc824b2980ecaf6e5b1b7f8856da440abf924f50b8bef40
|
7
|
+
data.tar.gz: 21863f42abef3df62dfd7992f9cefb46734cc294e425b92c98004a80a5e076280748a45bae2f93ec354957d5ac3348b05e0cebf75c5f47da086ce005f4af3858
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
### 0.1.
|
3
|
+
### 0.1.4 (2015-02-01)
|
4
|
+
- Cross-post languages with `lang_crosspost: true` in a post's YAML front-matter.
|
5
|
+
|
6
|
+
### 0.1.3 (2015-01-31)
|
4
7
|
- Fix: 'default' language maps to site.lang.
|
5
8
|
- Fix: Issue with access to site instance.
|
6
9
|
|
data/README.md
CHANGED
@@ -127,16 +127,16 @@ If you have [octopress-linkblog](https://github.com/octopress/linkblog) installe
|
|
127
127
|
|
128
128
|
### Cross-posting languages
|
129
129
|
|
130
|
-
If you would like to write a post which shows up in indexes and feeds for every language, set `
|
131
|
-
front-matter.
|
130
|
+
If you would like to write a post which shows up in indexes and feeds for every language, set `lang_crosspost: true` in your post's YAML front-matter.
|
132
131
|
|
133
132
|
```
|
134
133
|
title: "Ein nachdenklicher Beitrag"
|
135
|
-
lang:
|
134
|
+
lang: de
|
135
|
+
lang_crosspost: true
|
136
136
|
```
|
137
137
|
|
138
|
-
This post will show up with every language. However, it will be treated exactly like a post written in
|
139
|
-
|
138
|
+
This post will show up with every language. However, it will be treated exactly like a post written in German
|
139
|
+
and will have one canonical URL.
|
140
140
|
|
141
141
|
### Language in permalinks
|
142
142
|
|
@@ -46,7 +46,7 @@ module Octopress
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def crossposts
|
49
|
-
site.posts.select(&:
|
49
|
+
site.posts.select(&:crosspost_languages)
|
50
50
|
end
|
51
51
|
|
52
52
|
def main_language_posts
|
@@ -88,16 +88,11 @@ module Octopress
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def page_payload(lang)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
payload['linkposts'] = linkposts_by_language[lang]
|
97
|
-
payload['articles'] = articles_by_language[lang]
|
98
|
-
end
|
99
|
-
|
100
|
-
payload
|
91
|
+
{
|
92
|
+
'posts' => posts_by_language[lang],
|
93
|
+
'linkposts' => linkposts_by_language[lang],
|
94
|
+
'articles' => articles_by_language[lang]
|
95
|
+
}
|
101
96
|
end
|
102
97
|
|
103
98
|
def site_payload
|
@@ -72,16 +72,12 @@ module Jekyll
|
|
72
72
|
|
73
73
|
def lang
|
74
74
|
if data['lang']
|
75
|
-
if data['lang'].downcase == 'all'
|
76
|
-
@language_crosspost = true
|
77
|
-
data['lang'] = site.config['lang']
|
78
|
-
end
|
79
75
|
data['lang'].downcase
|
80
76
|
end
|
81
77
|
end
|
82
78
|
|
83
|
-
def
|
84
|
-
|
79
|
+
def crosspost_languages
|
80
|
+
data['lang_crosspost']
|
85
81
|
end
|
86
82
|
|
87
83
|
def url_placeholders
|
@@ -34,34 +34,19 @@ module Octopress
|
|
34
34
|
#
|
35
35
|
def set_lang(lang)
|
36
36
|
@context.environments.first['page']['lang'] = lang
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
if defined? Octopress::Linkblog
|
41
|
-
site['linkposts'] = site['linkposts_by_language'][lang]
|
42
|
-
site['articles'] = site['articles_by_language'][lang]
|
37
|
+
Multilingual.page_payload(lang).each do |key,value|
|
38
|
+
@context.environments.first['site'][key] = value
|
43
39
|
end
|
44
40
|
end
|
45
41
|
|
46
42
|
def store_state
|
47
43
|
@current_lang = @context['page.lang']
|
48
|
-
@
|
49
|
-
|
50
|
-
if defined? Octopress::Linkblog
|
51
|
-
@articles = @context['site.articles']
|
52
|
-
@links = @context['site.linkposts']
|
53
|
-
end
|
44
|
+
@site = @context['site'].clone
|
54
45
|
end
|
55
46
|
|
56
47
|
def restore_state
|
57
48
|
@context.environments.first['page']['lang'] = @current_lang
|
58
|
-
|
59
|
-
site['posts'] = @posts
|
60
|
-
|
61
|
-
if defined? Octopress::Linkblog
|
62
|
-
site['linkposts'] = @links
|
63
|
-
site['articles'] = @articles
|
64
|
-
end
|
49
|
+
@context.environments.first['site'] = @site
|
65
50
|
end
|
66
51
|
|
67
52
|
def lang
|