fix: Use page_title with fallback to name for portal display titles (#13719)

This commit is contained in:
Sivin Varghese
2026-03-05 14:20:31 +05:30
committed by GitHub
parent 42a244369d
commit 3ea5f258a4
5 changed files with 10 additions and 6 deletions

View File

@@ -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

View File

@@ -34,7 +34,7 @@ By default, it renders:
<% if content_for?(:head) %>
<%= yield(:head) %>
<% else %>
<title><%= @portal.page_title%></title>
<title><%= @portal.display_title %></title>
<% end %>
<% if @portal.logo.present? %>

View File

@@ -1,7 +1,7 @@
<% if !@is_plain_layout_enabled %>
<% content_for :head do %>
<title><%= @portal.name %></title>
<meta name="title" content="<%= @portal.name %>">
<title><%= @portal.display_title %></title>
<meta name="title" content="<%= @portal.display_title %>">
<% if @og_image_url.present? %>
<meta name="twitter:card" content="summary_large_image">

View File

@@ -1,5 +1,5 @@
<% content_for :head do %>
<title><%= @article.title %> | <%= @portal.name %></title>
<title><%= @article.title %> | <%= @portal.display_title %></title>
<% if @article.meta["title"].present? %>
<meta name="title" content="<%= @article.meta["title"] %>">
<meta property="og:title" content="<%= @article.meta["title"] %>">

View File

@@ -1,6 +1,6 @@
<% content_for :head do %>
<title><%= @category.name %> | <%= @portal.name %></title>
<meta name="title" content="<%= @category.name %> | <%= @portal.name %>">
<title><%= @category.name %> | <%= @portal.display_title %></title>
<meta name="title" content="<%= @category.name %> | <%= @portal.display_title %>">
<% if @category.description.present? %>
<meta name="description" content="<%= @category.description %>">
<meta property="og:description" content="<%= @category.description %>">