1

Can anyone help me how to change the structure of Joomla browser title page? I couldn't find the code structure.

As we all know that whatever info we put in the Menu "Page display" tab "Browser page title", it will always show the following format in the url.

(site name) - (browser page title info written in their respective menu) eg. abcnews - home page information

Now I want to change the above info in the following format:

eg. home page information | abcnews

Now how I am going to do it? How I am going the change the structure? If I know the file where this code is coming from then I can do it. So need help on this.

1 Answer 1

2

Firstly, for completeness, the position and display of the site title can be manipulated in the global configuration. But this only allows for three options: show before, show after, don't show.

For programmatic manipulation of the page title, you can get and set the JDocument object's property 'title'.

Hence with a system plugin you can do the following:

class plgSystemRandomname extends JPlugin {

    public function onBeforeCompileHead() {

        $app = JFactory::getApplication();

        // Only manipulate the title if this is the Frontend
        if(!$app->isClient('site')){
            return;
        }

        $document = JFactory::getDocument();

        $original = $document->title;

        // Do what ever you like

        $document->title = $new_title;

    }
}
1
  • Also have a look at route 66 which helps with URL structures
    – Eoin
    Commented Aug 2, 2018 at 0:03

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.