How to add search keyword as title in Search pages? (General)

by Sri, Wednesday, June 06, 2018, 04:56 (2122 days ago)

Dear team
Kindly help on this request.


How to add search keyword as title in Search pages?

Thank you
Sry

Avatar

How to add search keyword as title in Search pages?

by Auge ⌂, Wednesday, June 06, 2018, 08:20 (2122 days ago) @ Sri

Hello

Kindly help on this request.

How to add search keyword as title in Search pages?

Do you mean the title element that gets displayed in the browsers title bar (as highlighted in the screenshots)?

[image]

[image]

Or do you wish to include the search term into the sentence about the number of found entries (as highlighted in the last screenshot)?

[image]

Example: "24 Einträge gefunden" translates to "24 entries found" and would be changed to "24 entries for 'DSGVO' found".

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

How to add search keyword as title in Search pages?

by Sri, Wednesday, June 06, 2018, 09:02 (2122 days ago) @ Auge

Thanks a lot for the reply Auge.

Yes I would like search results to be as

24 entries for 'DSGVO' found


Also could you kindly help in another question:

How to bring the content of the message into the description field with a restriction of 300 first 300 characters.

Avatar

How to add search keyword as title in Search pages?

by Auge ⌂, Wednesday, June 06, 2018, 10:34 (2122 days ago) @ Sri

Thanks a lot for the reply Auge.

Yes I would like search results to be as

24 entries for 'DSGVO' found

This is a not so simple task but it's doable.

- Change the relevant strings (keys: one_posting_found, several_postings_found) in the language file(s), actually lines #214 and #215 in english.lang to introduce a placeholder for the search term(s). If we would do it, we would do it for all languages by replacing the original (mostly translated) strings by an english string with exception of the german language.
- Remove the singular-plural-logic from the templates search.inc.tpl line #20 and replace it with a simple output of a variable.
- Add the singular-plural-logic to the PHP-script search.inc.php, put the search term(s) into the string and assign it to the template mentioned above.

How to bring the content of the message into the description field with a restriction of 300 first 300 characters.

This would be a bigger challenge because at the moment we simply use the description from the forum settings. At the moment I see no way to change the value at a later processing step but generally it should be possible to generate a variable with a wanted content and the description from the forum setting as its fallback in the PHP-script and to inject the variable into the template as on many other places.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

How to add search keyword as title in Search pages?

by Sri, Wednesday, June 06, 2018, 14:20 (2122 days ago) @ Auge

Thanks again for your reply Auge!

Its very confusing for me as i am not a coder.

Just a small doubt.,

Cant i include something like this to the title tag in the main.tpl page?

<title>{if $page_title}{$page_title} - {elseif $subnav_location}{$subnav_location} - {elseif $search}{$search}- {/if}{$settings.forum_name|escape:"html"}</title>

and also
<meta name="description" content="{if $subject}{$subject}" />

Thank You
Sri

How to add search keyword as title in Search pages?

by Sri, Thursday, June 07, 2018, 15:48 (2121 days ago) @ Sri

Thanks again for your reply Auge!

Its very confusing for me as i am not a coder.

Just a small doubt.,

Cant i include something like this to the title tag in the main.tpl page?

<title>{if $page_title}{$page_title} - {elseif $subnav_location}{$subnav_location} - {elseif $search}{$search}- {/if}{$settings.forum_name|escape:"html"}</title>

and also
<meta name="description" content="{if $subject}{$subject}" />

Thank You
Sri

I tried it and not working . Is it not possible Auge to do like this?

RSS Feed of thread