jekyll-locales 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +5 -2
- data/lib/jekyll/locales/site.rb +23 -8
- data/lib/jekyll/locales/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7001f707bc9b90e87e3e3cf0bf9df320d9caf192a4dd3a3b8a521663fb7d673
|
4
|
+
data.tar.gz: 4df383de252c0609faace3eaf018f54652bb262b5238ed71e2b78d393cdde521
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fb401347ed58d7172981c1a403472047065c8a9992c84478f6202c4701c05676c3e6989077a5e2344530b5e7e1113eb800c3bc7a22fefa2da0a2e02a105fde9
|
7
|
+
data.tar.gz: f8086dae05728e41d661611a89e50fb26319c98a96bb8f72922b94f355c78408dbe863d4fec3c72f14d213967e6a5760f536b8f3f13c75fed40db1488bdab01a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,10 +33,13 @@ locales:
|
|
33
33
|
- en
|
34
34
|
- ahr
|
35
35
|
- brasileiro
|
36
|
+
redirect: true
|
36
37
|
```
|
37
38
|
|
38
|
-
**The first locale is going to be your default locale**.
|
39
|
-
|
39
|
+
**The first locale is going to be your default locale**. If you use
|
40
|
+
a redirector.html, it will be the locale it will redirector to. If you
|
41
|
+
don't use a redirector, the default locale will be at the root of the
|
42
|
+
site.
|
40
43
|
|
41
44
|
## Posts
|
42
45
|
|
data/lib/jekyll/locales/site.rb
CHANGED
@@ -28,15 +28,19 @@ module Jekyll
|
|
28
28
|
|
29
29
|
symlink
|
30
30
|
process_single
|
31
|
+
# The default locale is placed at the root of the
|
32
|
+
# site and everything else is under a subdirectory, but we symlink
|
33
|
+
# root to default_locale for compatibility
|
34
|
+
self_symlink if default_locale? && !redirect?
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# XXX: Default is expected by Sutty so we always create it
|
38
|
+
default_delete
|
39
|
+
default_symlink
|
40
|
+
|
41
|
+
# If we enable the redirector, the root of the site will consist
|
42
|
+
# of an index.html that allows visitors to select their locale.
|
43
|
+
copy_redirector if redirect?
|
40
44
|
end
|
41
45
|
|
42
46
|
private
|
@@ -50,7 +54,10 @@ module Jekyll
|
|
50
54
|
config['locale'] = config['lang'] = locale
|
51
55
|
config['default_locale'] = default_locale
|
52
56
|
|
57
|
+
# Don't touch the config unless there's more than one locale or we
|
58
|
+
# aren't using a redirector
|
53
59
|
return unless locales?
|
60
|
+
return if default_locale? && !redirect?
|
54
61
|
|
55
62
|
@dest = config['destination'] = locale_destination
|
56
63
|
config['baseurl'] = locale_baseurl
|
@@ -62,7 +69,11 @@ module Jekyll
|
|
62
69
|
end
|
63
70
|
|
64
71
|
def default_locale
|
65
|
-
locales.first
|
72
|
+
@default_locale ||= locales.first
|
73
|
+
end
|
74
|
+
|
75
|
+
def default_locale?
|
76
|
+
default_locale == locale
|
66
77
|
end
|
67
78
|
|
68
79
|
# Cache original destination
|
@@ -92,6 +103,10 @@ module Jekyll
|
|
92
103
|
FileUtils.ln_s("_#{locale}", '_posts')
|
93
104
|
end
|
94
105
|
|
106
|
+
def redirect?
|
107
|
+
config.fetch('redirect', false)
|
108
|
+
end
|
109
|
+
|
95
110
|
# TODO: Make configurable
|
96
111
|
def redirector
|
97
112
|
@redirector ||= File.join(locale_destination, 'redirector.html')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-locales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
requirements: []
|
119
|
-
|
120
|
-
rubygems_version: 2.7.6.2
|
119
|
+
rubygems_version: 3.0.3
|
121
120
|
signing_key:
|
122
121
|
specification_version: 4
|
123
122
|
summary: Jekyll plugin for localized sites
|