camaleon_cms 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of camaleon_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/controllers/concerns/frontend_concern.rb +53 -0
- data/app/helpers/html_helper.rb +1 -0
- data/config/sitemap.rb +0 -1
- data/lib/camaleon_cms/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: 8f67ae45b2071c931c9ed2a907215b401e13de8c
|
4
|
+
data.tar.gz: 9dbcdc4eaf771c3d187f7dee1bf13dc09a53049b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8fabb6d2a79d05c95dca7dbc26b21eaac211a00d60082b313328a0f4fffdb5c8e0b8f8ccf9a9a2fbb84d17d82ad6c0efcf048754bc2caaab4709518038285ef
|
7
|
+
data.tar.gz: 8ae1b1be332e46aa4b1e017f84badcb76e224425a127dc7650d0d771906d190be4eea9348c223d3b3de3e644db38d70bce3555faea3128c5482a58646d13fb90
|
@@ -9,6 +9,59 @@
|
|
9
9
|
module FrontendConcern extend ActiveSupport::Concern
|
10
10
|
# visiting sitemap.xml
|
11
11
|
def sitemap
|
12
|
+
# create sitemap directory
|
13
|
+
sitemaps_dir = Rails.root.join("public", "sitemaps").to_s
|
14
|
+
FileUtils.mkdir(sitemaps_dir) unless Dir.exist?(sitemaps_dir)
|
15
|
+
|
16
|
+
site = current_site
|
17
|
+
folder "sitemaps/#{site.slug}"
|
18
|
+
host site.the_url.to_s.parse_domain
|
19
|
+
langs = site.get_languages
|
20
|
+
|
21
|
+
sitemap :site do
|
22
|
+
url root_url, priority: 1.0, change_freq: "daily"
|
23
|
+
|
24
|
+
langs.each_with_index{|l, index| url site.the_url(locale: index==0?nil:l), last_mod: site.updated_at, priority: 0.9 }
|
25
|
+
url sitemap_url
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
sitemap_for site.posts.public_posts, name: :published_posts do |post|
|
30
|
+
post = post.decorate
|
31
|
+
langs.each_with_index{|l, index| url post.the_url(locale: index==0?nil:l), last_mod: post.updated_at, priority: 0.7 }
|
32
|
+
end
|
33
|
+
|
34
|
+
sitemap_for site.full_categories.no_empty, name: :categories do |cat|
|
35
|
+
cat = cat.decorate
|
36
|
+
langs.each_with_index{|l, index| url cat.the_url(locale: index==0?nil:l), last_mod: cat.updated_at, priority: 0.5 }
|
37
|
+
end
|
38
|
+
|
39
|
+
sitemap_for site.post_types, name: :groups do |ptype|
|
40
|
+
ptype = ptype.decorate
|
41
|
+
langs.each_with_index{|l, index| url ptype.the_url(locale: index==0?nil:l), last_mod: ptype.updated_at, priority: 0.3 }
|
42
|
+
end
|
43
|
+
|
44
|
+
sitemap_for site.post_tags, name: :tags do |ptag|
|
45
|
+
ptag = ptag.decorate
|
46
|
+
langs.each_with_index{|l, index| url ptag.the_url(locale: index==0?nil:l), last_mod: ptag.updated_at, priority: 0.2 }
|
47
|
+
end
|
48
|
+
|
49
|
+
# hooks
|
50
|
+
c = CamaleonController.new
|
51
|
+
c.instance_eval do
|
52
|
+
@current_site = site
|
53
|
+
@_hooks_skip = []
|
54
|
+
end
|
55
|
+
|
56
|
+
# sample: sitemap :site2 do \n url root_url \n end
|
57
|
+
r = {site: site, eval: ""}; c.hooks_run("sitemap", r)
|
58
|
+
instance_eval(r[:eval]) if r[:eval].present?
|
59
|
+
|
60
|
+
ping_with "http://#{host}/sitemap.xml"
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def sitemap2
|
12
65
|
path = Rails.root.join("public", "sitemaps", current_site.slug, "sitemap.xml")
|
13
66
|
if File.exists?(path)
|
14
67
|
respond_to do |format|
|
data/app/helpers/html_helper.rb
CHANGED
@@ -49,6 +49,7 @@ module HtmlHelper
|
|
49
49
|
# return all js libraries added [aa.js, bb,js, ..]
|
50
50
|
# def get_assets_js
|
51
51
|
def draw_custom_assets
|
52
|
+
html_helpers_init unless @_assets_libraries.present?
|
52
53
|
libs = []
|
53
54
|
@_assets_libraries.each do |key, assets|
|
54
55
|
libs += assets[:css] if assets[:css].present?
|
data/config/sitemap.rb
CHANGED
data/lib/camaleon_cms/version.rb
CHANGED