summaryrefslogtreecommitdiff
path: root/app/controllers/shared_previews_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/shared_previews_controller.rb')
-rw-r--r--app/controllers/shared_previews_controller.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/shared_previews_controller.rb b/app/controllers/shared_previews_controller.rb
new file mode 100644
index 0000000..a8a540f
--- /dev/null
+++ b/app/controllers/shared_previews_controller.rb
@@ -0,0 +1,13 @@
1class SharedPreviewsController < ApplicationController
2 def show
3 @page = Page.find_by!(preview_token: params[:token])
4
5 if @page.node && @page.node.head_id == @page.id
6 redirect_to node_path(@page.node)
7 return
8 end
9
10 response.headers['X-Robots-Tag'] = 'noindex'
11 render template: @page.valid_template, layout: "application"
12 end
13end