aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Arndt <parndt@gmail.com>2011-09-10 16:57:27 -0700
committerPhilip Arndt <parndt@gmail.com>2011-09-10 16:57:27 -0700
commitaf16fd8263db9cd03abead7792898f5c8a7df8e7 (patch)
treef7303aa3b36a1a18ff2ff2d0381b734690b9daca
parent97ad55cbf0350752fdbb01b64980b592b463f19f (diff)
parentc1903f5797300202f15a4cd34ec7ded9c9f4fd9d (diff)
downloadrefinerycms-blog-af16fd8263db9cd03abead7792898f5c8a7df8e7.tar.gz
refinerycms-blog-af16fd8263db9cd03abead7792898f5c8a7df8e7.tar.bz2
refinerycms-blog-af16fd8263db9cd03abead7792898f5c8a7df8e7.zip
Merge pull request #134 from keram/master
re support canonical on multilanguage website
-rw-r--r--app/controllers/blog/posts_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb
index edac5ab..7eb167d 100644
--- a/app/controllers/blog/posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -9,7 +9,7 @@ module Blog
def index
# Rss feeders are greedy. Let's give them every blog post instead of paginating.
- (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss?
+ (@blog_posts = BlogPost.live.includes(:comments, :categories).all) if request.format.rss?
respond_with (@blog_posts) do |format|
format.html
format.rss
@@ -18,7 +18,8 @@ module Blog
def show
@blog_comment = BlogComment.new
-
+ @canonical = url_for(:locale => ::Refinery::I18n.default_frontend_locale) if canonical?
+
respond_with (@blog_post) do |format|
format.html { present(@blog_post) }
format.js { render :partial => 'post', :layout => false }
@@ -100,6 +101,9 @@ module Blog
def find_tags
@tags = BlogPost.tag_counts_on(:tags)
end
-
+
+ def canonical?
+ ::Refinery.i18n_enabled? && ::Refinery::I18n.default_frontend_locale != ::Refinery::I18n.current_frontend_locale
+ end
end
end \ No newline at end of file