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? %>