From 3ea5f258a41c550cda164a11d1761b482dbd591c Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 5 Mar 2026 14:20:31 +0530 Subject: [PATCH] fix: Use page_title with fallback to name for portal display titles (#13719) --- app/models/portal.rb | 4 ++++ app/views/layouts/portal.html.erb | 2 +- app/views/public/api/v1/portals/_hero.html.erb | 4 ++-- app/views/public/api/v1/portals/articles/show.html.erb | 2 +- app/views/public/api/v1/portals/categories/show.html.erb | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/models/portal.rb b/app/models/portal.rb index 67b5427e5..e04e40f6a 100644 --- a/app/models/portal.rb +++ b/app/models/portal.rb @@ -68,6 +68,10 @@ class Portal < ApplicationRecord self[:color].presence || DEFAULT_COLOR end + def display_title + page_title.presence || name + end + private def config_json_format diff --git a/app/views/layouts/portal.html.erb b/app/views/layouts/portal.html.erb index 72b086d4b..78418881a 100644 --- a/app/views/layouts/portal.html.erb +++ b/app/views/layouts/portal.html.erb @@ -34,7 +34,7 @@ By default, it renders: <% if content_for?(:head) %> <%= yield(:head) %> <% else %> - <%= @portal.page_title%> + <%= @portal.display_title %> <% end %> <% if @portal.logo.present? %> diff --git a/app/views/public/api/v1/portals/_hero.html.erb b/app/views/public/api/v1/portals/_hero.html.erb index 0ce5ddde6..8fcdb2c0d 100644 --- a/app/views/public/api/v1/portals/_hero.html.erb +++ b/app/views/public/api/v1/portals/_hero.html.erb @@ -1,7 +1,7 @@ <% if !@is_plain_layout_enabled %> <% content_for :head do %> - <%= @portal.name %> - + <%= @portal.display_title %> + <% if @og_image_url.present? %> diff --git a/app/views/public/api/v1/portals/articles/show.html.erb b/app/views/public/api/v1/portals/articles/show.html.erb index 9568709b9..5ca116f89 100644 --- a/app/views/public/api/v1/portals/articles/show.html.erb +++ b/app/views/public/api/v1/portals/articles/show.html.erb @@ -1,5 +1,5 @@ <% content_for :head do %> - <%= @article.title %> | <%= @portal.name %> + <%= @article.title %> | <%= @portal.display_title %> <% if @article.meta["title"].present? %> "> "> diff --git a/app/views/public/api/v1/portals/categories/show.html.erb b/app/views/public/api/v1/portals/categories/show.html.erb index 702483355..6657559d0 100644 --- a/app/views/public/api/v1/portals/categories/show.html.erb +++ b/app/views/public/api/v1/portals/categories/show.html.erb @@ -1,6 +1,6 @@ <% content_for :head do %> - <%= @category.name %> | <%= @portal.name %> - + <%= @category.name %> | <%= @portal.display_title %> + <% if @category.description.present? %>