From 4df88b601b1900c287051d827eaff46f498f60d0 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Wed, 19 Aug 2026 16:05:40 +0200 Subject: Redirect a page to a node or an external URL Page#redirect_target resolves the precedence and returns nil for a destination that is restricted or has no head, so a page with a broken target renders itself rather than linking nowhere. The banner partial will call the same method, so the redirect and the link cannot drift. One hop, no exceptions, checked in publish_draft! rather than as a validation: two nodes publishing concurrently could each pass a save-time check and still produce a chain. "Live" means heads only, a draft redirect that has not published is not yet a link anyone can follow. Node.search excludes redirecting pages. editor_search does not: an editor looking for one searches by title, and only the body is worth hiding. --- app/controllers/nodes_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers') diff --git a/app/controllers/nodes_controller.rb b/app/controllers/nodes_controller.rb index ef47f258..47b8573a 100644 --- a/app/controllers/nodes_controller.rb +++ b/app/controllers/nodes_controller.rb @@ -282,7 +282,7 @@ class NodesController < ApplicationController def page_params params.fetch(:page, {}).permit(:title, :abstract, :body, :template_name, :published_at, :user_id, :slug, :parent_node_id, - :external_url) + :external_url, :redirect, :redirect_node_id) end def find_node -- cgit v1.3