FEATURE: add override for crawler title and description tags (#32259)

In https://github.com/discourse/discourse/pull/32159 we overrode the
`og:` and `twitter:` title and description but for some crawlers, we
need to override the `title` and `description` meta tag as well.
This commit is contained in:
Gabriel Grubba
2025-04-11 09:38:11 -03:00
committed by GitHub
parent 7103078fa1
commit c484d2fd88
3 changed files with 92 additions and 23 deletions

View File

@ -270,6 +270,24 @@ module ApplicationHelper
(request ? I18n.locale.to_s : SiteSetting.default_locale).sub("_", "-")
end
def crawlable_title_content
DiscoursePluginRegistry.apply_modifier(
:meta_data_content,
content_for(:title) || SiteSetting.title,
:title,
{ url: request.fullpath },
)
end
def crawlable_description_content
DiscoursePluginRegistry.apply_modifier(
:meta_data_content,
@description_meta || SiteSetting.site_description,
:description,
{ url: request.fullpath },
)
end
# Creates open graph and twitter card meta data
def crawlable_meta_data(opts = nil)
opts ||= {}