grav-plugin-simplesearch and can’t figure out how to translate the
page title in the head
<title> section of the
search results page.
Title is -
And I’m certain, that this is not:
In languages.yaml the first few lines need to be something like:
SEARCH_PLACEHOLDER: 'Search …'
SEARCH_RESULTS: 'Search Results Test'
That gives me the correct placeholder and the test heading indicated.
Plugin SimpleSearch does not manipulate the
<title> element inside the
<head> of the page. That’s the territory of template
base.html.twig from the current theme.
SimpleSearch displays the result of the search in a page pointed at by configuration setting
route: /search which is set in config file
If page /user/pages/search does not exist, the plugin will use fall-back page /user/plugins/simplesearch/pages/simplesearch.md, which contains the hardcoded page title “Search Results” and a few other settings for the search results.
So, if you create page /user/pages/search/default.md and add the following frontmatter from the fall-back page, you can set any title you like:
title: Your preferred title
If you have a multi-language site, you can add multiple pages, each with its own language extension and translated title and slug.
Of course, you can change setting
route to any other route and create a page in a folder structure mimicking the route.
Thank you guys!
@zfiddler, pardon me, I’ve forgotten to display my all strings with correct translations. It was with language prefix:
SEARCH_RESULTS: 'Paieškos rezultatai'
So, it wasn’t working from the beginning…
I had to create a separate page, as @pamtbaau suggested