News:

Wondering if this will always be free?  See why free is better.

Main Menu

How to edit page titles.

Started by KBExit, September 22, 2019, 09:15:05 PM

Previous topic - Next topic

KBExit

Hello I was wondering if there was any way to edit the titles of each page in the forum software to achieve my end result.
My end result is to be able to go from each page of SMF and it retain the website title.

By this I mean:
BoardIndex = Website - Index
Viewing the board = Website - Board Name
Viewing a post = Website - Subject Name
Viewing calendar = Website - Calendar

Any help would be great.

P.S: I have already looked into the sources but I still wasn't able to figure it out. It's limiting what I can do with such little experience in PHP.

Thank you all in advanced!

Antechinus

Those are default language strings. You can edit them in Administration Center > Languages > Edit Languages.

Click on the language name, then try "General strings" from the dropdown. I think they are under that category, but if some aren't there try some of the other options.

KBExit

I looked through the file a little bit... Are we on the same page? lol

I want to make it so it shows up on the tabs as 'Web Name - Topic'
'Web Name - Board'
Web Name - Page'

I changed some items to include
%1$s
like the other ones do but it didn't change anything. I'll fiddle with it some more in the mean time.

Antechinus

Oh I get it. You basically want to duplicate the strings that are used in the who's online section, like "Viewing the calendar", but call them as general page titles (with a bit of added customisation).

Too tricky for me. That's something you'll need a Sources whiz for.


drewactual

#4
tabs?  like at the top of the browser... for instance, where this tab reads: "How to edit page titles." on the tabs first line of browser?

if so, in the index.template of the theme you're using, find:


<title>', $context['page_title_html_safe'], '</title>';


change it to: (using yourwebpage as the current title of your web page or the 'main' title you want to use)

<title>yourwebpage - ', $context['page_title_html_safe'], '</title>';


now if you're doing something else, there is another way that will require an include file for your inde.template, or script a script to be added in the place of the <title> tag, and that senses what board/message/action and applies a <title> tag depending... 

KBExit

#5
Quote from: drewactual on September 23, 2019, 09:40:33 PM
tabs?  like at the top of the browser... for instance, where this tab reads: "How to edit page titles." on the tabs first line of browser?

if so, in the index.template of the theme you're using, find:


<title>', $context['page_title_html_safe'], '</title>';


change it to: (using yourwebpage as the current title of your web page or the 'main' title you want to use)

<title>yourwebpage - ', $context['page_title_html_safe'], '</title>';


now if you're doing something else, there is another way that will require an include file for your inde.template, or script a script to be added in the place of the <title> tag, and that senses what board/message/action and applies a <title> tag depending...

This is exactly what I needed! Thank you!
Now I have to figure out how to fix the Index.
It shows as Website - Website now.
I think I can figure that out from here now that all my pages load exactly the way I want it to! Thank you so much!

Edit:
Yup! Got into the sources folder and modified the code in the title tag for the Board Index file and did some backspaces. I guess I changed that in the past and that may have messed with it? Again, I really appreciate the help that you two put in for me!

Mick.

Optimus mod does that automatically. 

KBExit

Quote from: Mick. on September 26, 2019, 12:18:32 AM
Optimus mod does that automatically.
I had no idea, I guess I should have searched and looked around better  :o
Thanks for the tip though Mick!

tghm131

at ../Themes/default/languages/index_english.php
find: - Index
replace it to anythings!

Kindred

Quote from: tghm131 on December 25, 2021, 04:43:40 AMat ../Themes/default/languages/index_english.php
find: - Index
replace it to anythings!


Ummm,  no.

This question was already answered,  and, additionally,  your statement is the wrong way to do what the OP requested. What you suggested won't work
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: