Added meta robots tag to the default layout; added error handling to published pages
This commit is contained in:
parent
9e7306fb0a
commit
d3b25c8a19
|
@ -2,7 +2,7 @@
|
||||||
# Likewise will all the methods added be available for all controllers.
|
# Likewise will all the methods added be available for all controllers.
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
before_filter :connect_to_model, :setup_url_generator, :set_content_type_header
|
before_filter :connect_to_model, :setup_url_generator, :set_content_type_header, :set_robots_metatag
|
||||||
after_filter :remember_location, :teardown_url_generator
|
after_filter :remember_location, :teardown_url_generator
|
||||||
|
|
||||||
observer :page_observer
|
observer :page_observer
|
||||||
|
@ -152,6 +152,14 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_robots_metatag
|
||||||
|
if controller_name == 'wiki' and %w(show published).include? action_name
|
||||||
|
@robots_metatag_value = 'index,follow'
|
||||||
|
else
|
||||||
|
@robots_metatag_value = 'noindex,nofollow'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def setup_url_generator
|
def setup_url_generator
|
||||||
PageRenderer.setup_url_generator(UrlGenerator.new(self))
|
PageRenderer.setup_url_generator(UrlGenerator.new(self))
|
||||||
end
|
end
|
||||||
|
|
|
@ -195,12 +195,13 @@ class WikiController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def published
|
def published
|
||||||
if @web.published?
|
render_text("Published version of web '#{@web_name}' is not available", 404) and return if not @web.published?
|
||||||
page = wiki.read_page(@web_name, @page_name || 'HomePage')
|
|
||||||
@renderer = PageRenderer.new(page.revisions.last)
|
page_name = @page_name || 'HomePage'
|
||||||
else
|
page = wiki.read_page(@web_name, page_name)
|
||||||
redirect_home
|
render_text("Page '#{page_name}' not found", 404) and return unless page
|
||||||
end
|
|
||||||
|
@renderer = PageRenderer.new(page.revisions.last)
|
||||||
end
|
end
|
||||||
|
|
||||||
def revision
|
def revision
|
||||||
|
|
|
@ -14,6 +14,7 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
</title>
|
</title>
|
||||||
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
|
<meta name="robots" content="<%= @robots_metatag_value %>" />
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
h1#pageName, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, #TextileHelp h3 {
|
h1#pageName, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, #TextileHelp h3 {
|
||||||
|
|
Loading…
Reference in a new issue