[Posts] Add redirect support to wiki excerpts (#909)

This commit is contained in:
Cinder 2025-02-11 22:27:03 -08:00 committed by GitHub
parent 436eb260e8
commit aa606b7125
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,12 @@ class PostsController < ApplicationController
@query = tag_query.nil? ? [] : tag_query.strip.split(/ /, 2).compact_blank
if @query.length == 1
@wiki_page = WikiPage.titled(@query[0])
# redirect?
if @wiki_page.present? && @wiki_page.parent.present?
@wiki_page = WikiPage.titled(@wiki_page.parent)
end
@wiki_text = @wiki_page.present? ? @wiki_page.body : ""
if @wiki_text.present?
@wiki_text = @wiki_text