refinerycms-routes 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/sitemap/index.xml.builder +28 -0
- data/lib/refinerycms-routes.rb +1 -1
- metadata +4 -3
@@ -0,0 +1,28 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
|
3
|
+
xml.urlset "xmlns" => "http://www.sitemaps.org/schemas/sitemap/0.9" do
|
4
|
+
|
5
|
+
@locales.each do |locale|
|
6
|
+
::I18n.locale = locale
|
7
|
+
Page.live.in_menu.includes(:parts).each do |page|
|
8
|
+
page_url = if page.routes.where(:locale => locale).any?
|
9
|
+
page_path = page.routes.where(:locale => locale).first.url
|
10
|
+
[request.protocol, request.host_with_port, "/#{page_path}"].join
|
11
|
+
# exclude sites that are external to our own domain.
|
12
|
+
elsif page.url.is_a?(Hash)
|
13
|
+
# This is how most pages work without being overriden by link_url
|
14
|
+
page.url.merge({:only_path => false})
|
15
|
+
elsif page.url.to_s !~ /^http/
|
16
|
+
# handle relative link_url addresses.
|
17
|
+
[request.protocol, request.host_with_port, page.url].join
|
18
|
+
end
|
19
|
+
|
20
|
+
# Add XML entry only if there is a valid page_url found above.
|
21
|
+
xml.url do
|
22
|
+
xml.loc url_for(page_url)
|
23
|
+
xml.lastmod page.updated_at.to_date
|
24
|
+
end if page_url.present? and page.show_in_menu?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/refinerycms-routes.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Charles Barbier
|
@@ -46,6 +46,7 @@ files:
|
|
46
46
|
- app/views/admin/routes/edit.html.erb
|
47
47
|
- app/views/admin/routes/index.html.erb
|
48
48
|
- app/views/admin/routes/new.html.erb
|
49
|
+
- app/views/sitemap/index.xml.builder
|
49
50
|
- db/migrate/1_create_routes.rb
|
50
51
|
- db/seeds/routes.rb
|
51
52
|
homepage: http://github.com/unixcharles/refinerycms-copywriting
|