Alex_P
(Alex P.)
December 17, 2019, 7:05pm
1
Is it possible to change the category page titles from e.g. “Latest %category% topics” to “%category% - latest topics”?
“Latest Programming topics” sounds fine in English, but in Russian “Последние Программирование темы” is not correct and looks weird.
1 Like
maiki
(maiki)
December 17, 2019, 10:51pm
2
Yep, pop over to /admin/customize/site_texts?q=latest topics
.
3 Likes
Alex_P
(Alex P.)
December 18, 2019, 6:31am
3
Which key? I don’t see it here. Also tried to search by categoryName
.
maiki
(maiki)
December 18, 2019, 9:14pm
4
You should search for the text you want to change. I’m guessing the js.categories.latest
is what you are looking for, but if you can’t find the string directly, you should seek further assistance.
Stephen
(Stephen)
December 18, 2019, 9:15pm
5
If this is going to benefit more than your community consider contributing to the Russian translation on Transifex.
Editing local strings is a last resort.
2 Likes
Alex_P
(Alex P.)
December 18, 2019, 9:31pm
6
yeah, I usually contribute.
maiki:
js.categories.latest
No, it’s the column on the categories page.
I don’t see here anything like Latest {{categoryName}} topics
Instead of posting examples that are “like” what you’re looking for, can you post some of the exact HTML that’s around that text? i.e. knowing attributes may help locate the template.
3 Likes
Alex_P
(Alex P.)
December 19, 2019, 6:30am
8
I was talking about HTML <title>
.
e.g. on this forum:
<title>Latest support topics - Discourse Meta</title>
It’s not really related to locales, to make it simpler, let’s say that I want to change it to
<title>support - latest topics - Discourse Meta</title>
maiki
(maiki)
December 19, 2019, 7:36am
9
js.filters.latest.title
is applied to the title, but it is also referred to in other parts of the UI. I recommend fixing it in locale data, as an override may require a theme component to detach that functionality.
That string can not be empty.
Alex_P
(Alex P.)
December 19, 2019, 7:55am
10
Yes, but it’s just one part of the title ({{js.filters.latest.title}} {{categoryName}} ...
), that is it’s not possible to change the word order.
What do you mean? As far as I can see there is no string with all 3 parts in the customization admin UI.
So maybe it’s a feature request…
Would be better to do it on the server side, so it would appear correctly in the search engines.
Thanks. Involved files
https://github.com/discourse/discourse/blob/master/app/views/layouts/application.html.erb#L=5
https://github.com/discourse/discourse/blob/master/app/controllers/categories_controller.rb#L37-L41
Though there is no “customize” solution available, there are some possibilities.
A theme / component that rewrites the title text
A plugin that allows working with the title variable value
Make sure there’s a is_homepage
and SiteSetting.short_site_description.present
?
1 Like
Alex_P
(Alex P.)
December 20, 2019, 8:11am
12
Looks like I found it: js.filters.with_category in Customize.
e.g. I changed it from %{filter} %{category} topics
to %{category} - %{filter} topics
( %{category} - %{filter} темы
in Russian).
Mittineague:
Involved files
The second file is for the /categories
page, not for category topics. I needed this one:
list.more_topics_url = construct_url_with(:next, list_opts)
list.prev_topics_url = construct_url_with(:prev, list_opts)
if Discourse.anonymous_filters.include?(filter)
@description = SiteSetting.site_description
@rss = filter
# Note the first is the default and we don't add a title
if (filter.to_s != current_homepage) && use_crawler_layout?
filter_title = I18n.t("js.filters.#{filter.to_s}.title", count: 0)
if list_opts[:category] && @category
@title = I18n.t('js.filters.with_category', filter: filter_title, category: @category.name)
else
@title = I18n.t('js.filters.with_topics', filter: filter_title)
end
@title << " - #{SiteSetting.title}"
elsif @category.blank? && (filter.to_s == current_homepage) && SiteSetting.short_site_description.present?
@title = "#{SiteSetting.title} - #{SiteSetting.short_site_description}"
end
end
respond_with_list(list)
2 Likes
system
(system)
Closed
January 19, 2020, 8:19am
13
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.