1

How do I set the <head>'s <title> tag in MVC component's code? I know the page title (which would appear on top of the page) can be set in several ways but the <title> seems to be only settable from menu item properties. I need to set <title> without using menu items (from component code).

1

1 Answer 1

2

You can use Joomla's setTitle() method, like so:

use Joomla\CMS\Factory; Factory::getDocument()->setTitle('My Custom Title'); 
2
  • It seems to set the tile on the site but not the <title> tag contents in the <head> section of the page. Commented May 6, 2020 at 12:08
  • @ed22 - Working perfectly fine for me. The browser sets the page title based on the <title> value, so I'm not sure how the tab shows the title but the <title> isn't updating. Commented May 6, 2020 at 13:00

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.