1

When editing articles in Joomla 4, the browser tab shows "Articles: Edit - [site name]". This means that all articles show the same text in the browser tab, which is not very helpful if one is editing a number of articles at the same time.

It would be most helpful if one could set the title of the browser tab to show the title of the article.

Any ideas on how to do this?

Thank you!

1 Answer 1

1

It's not possible to do this by configuration data, I'm afraid.

The title is written in libraries/src/Toolbar/ToolbarHelper.php in the title() function. To change that you'd need to write a plugin that fires on eg onAfterDispatch.

In the plugin you'd need to check you're on the administrator side, and check the application input data to ensure that you're editing an article. Then you can get the article id from the input data and query in the database to get the article title, and set the browser title using Factory::getDocument()->setTitle($articleTitle).

The plugin would change this for everyone on the system. However in the plugin you could also check the logged-in user and change it just for yourself, rather than for everybody.

1
  • Thank you, Robbie, that is helpful. I will look into that. Commented Jul 18, 2023 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.