seo_cache 1.0.3 → 1.0.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 -0
- data/README.md +4 -0
- data/lib/seo_cache/populate_cache.rb +28 -10
- data/lib/seo_cache/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ee65da1765c3f78ac9f0ede65e7271880378217d20deeed9df1476f524f5c9d
|
4
|
+
data.tar.gz: 473a51c49bab2d40fab978611b13e872185d89cb834d57352b5ca5cb10aa627d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c783ce23dd0122988c73e44110fd2173033a67bdf77029d3c5ba57943b6abf343ae141d3c69b46ef1575366b05b185fdcaba50c3709a0b4a1ee99c8f34fa13
|
7
|
+
data.tar.gz: 9b056081949ce4207f996748d4750fe37c7128afe88341d81a6c2b0ea04f3024f051eabb6fff4cca68f0e7976c1b476076ecce4548a7a510696a04692dbf241d
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -227,6 +227,8 @@ end
|
|
227
227
|
|
228
228
|
You can add the `force_cache: true` option to `SeoCache::PopulateCache` for overwrite cached data.
|
229
229
|
|
230
|
+
If your website has several domains (.com, .fr, ...), you need to generate your urls for each locale (each key is the locale). And use the `with_locale_keys: true` option.
|
231
|
+
|
230
232
|
If you want to execute only through a rake task, you can comment the line which include the middleware. keep all options configured and remove only the middleware. Thus all pages will be cached and SeoCache isn't called for pages not in cache.
|
231
233
|
It's useful if you have a script which generates all website pages (based on sitemap for instance) and you run script every day.
|
232
234
|
|
@@ -275,6 +277,8 @@ location / {
|
|
275
277
|
rewrite ^/(.*)/$ /$1 last;
|
276
278
|
|
277
279
|
try_files /seo_cache/$uri/index$cache_extension /seo_cache/$uri$cache_extension /seo_cache/$uri $uri @rubyproxy;
|
280
|
+
# Or for multi-domains:
|
281
|
+
# try_files /seo_cache/fr/$uri/index$cache_extension /seo_cache/fr/$uri$cache_extension /seo_cache/fr/$uri $uri @rubyproxy;
|
278
282
|
}
|
279
283
|
|
280
284
|
location @rubyproxy {
|
@@ -11,23 +11,41 @@ module SeoCache
|
|
11
11
|
@page_render = PageRender.new
|
12
12
|
@page_caching = PageCaching.new
|
13
13
|
|
14
|
-
@force_cache
|
14
|
+
@force_cache = options.fetch(:force_cache, false)
|
15
|
+
@with_locale_keys = options.fetch(:with_locale_keys, false)
|
15
16
|
end
|
16
17
|
|
17
18
|
def perform
|
18
|
-
@
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
if @with_locale_keys
|
20
|
+
@paths.each do |locale, paths|
|
21
|
+
paths.each do |path|
|
22
|
+
generate_cache(path, locale)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
@paths.each do |path|
|
27
|
+
generate_cache(path)
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
ensure
|
30
32
|
@page_render.close_connection
|
31
33
|
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def generate_cache(path, locale = nil)
|
38
|
+
return if @page_caching.cache_exists?(path) && !@force_cache
|
39
|
+
|
40
|
+
url = @host + path
|
41
|
+
url += path.include?('?') ? '&' : '?'
|
42
|
+
url += "#{SeoCache.prerender_url_param}=true"
|
43
|
+
|
44
|
+
page_source = @page_render.get(url, false)
|
45
|
+
return unless page_source
|
46
|
+
|
47
|
+
path_cache_key = locale ? "/#{locale}#{path}" : path
|
48
|
+
@page_caching.cache(page_source, path_cache_key)
|
49
|
+
end
|
32
50
|
end
|
33
51
|
end
|
data/lib/seo_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seo_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FloXcoder
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
231
|
requirements: []
|
232
|
-
rubygems_version: 3.2.
|
232
|
+
rubygems_version: 3.2.17
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Cache dedicated for SEO with Javascript rendering
|