[BUG]: Page title not working in JCB #1255

Closed
opened 2025-09-18 12:13:45 +00:00 by Tom van der Laan · 13 comments
Member

What Happened?

Since 2 days or so the page titles are broken in JCB (i've been keeping up with the pre-test releases). Where it used to say the actual page i was on like Dynamic Gets. It now says JPAGETITLE.

Steps to reproduce the Bug

//

Which Joomla version are you compiling in?

//

Which PHP version are you compiling in?

//

Which Joomla versions are you targeting?

//

Which PHP version are you targeting?

//

Which Web server is JCB running on?

//

Which Relational Database is JCB running on?

//

Which OS is JCB running on?

//

Which JCB version are you using?

v5.1.2-beta3

Where in JCB did this issue occur?

Joomla Components(admin_views)

On which browsers did you encounter the issue?

Firefox, Safari

Additional Comments

No response

### What Happened? Since 2 days or so the page titles are broken in JCB (i've been keeping up with the pre-test releases). Where it used to say the actual page i was on like Dynamic Gets. It now says JPAGETITLE. ### Steps to reproduce the Bug // ### Which Joomla version are you compiling in? // ### Which PHP version are you compiling in? // ### Which Joomla versions are you targeting? // ### Which PHP version are you targeting? // ### Which Web server is JCB running on? // ### Which Relational Database is JCB running on? // ### Which OS is JCB running on? // ### Which JCB version are you using? v5.1.2-beta3 ### Where in JCB did this issue occur? Joomla Components(admin_views) ### On which browsers did you encounter the issue? Firefox, Safari ### Additional Comments _No response_
Tom van der Laan added the Bug label 2025-09-18 12:13:45 +00:00
Owner

This is interesting, I've been testing with numerous different systems on Joomla 5.3.3 and the latest Joomla 5.4.0-beta3 with the pretest versions of JCB.
I have not picked this issue anywhere.

image1.png
image2.png

This is interesting, I've been testing with numerous different systems on Joomla 5.3.3 and the latest Joomla 5.4.0-beta3 with the pretest versions of JCB. I have not picked this issue anywhere. ![image1.png](https://git.vdm.dev/attachments/44a934a2-cec3-4d30-ab7c-a78fc1687542) ![image2.png](https://git.vdm.dev/attachments/f4426f86-3b4a-4e12-8be2-85ad7cf497ee)
Author
Member

Hmmm weird. will have to investigate this some more then. must be something with my install then

Hmmm weird. will have to investigate this some more then. must be something with my install then
Author
Member

closing as its fixed and doesnt belong here.

closing as its fixed and doesnt belong here.
Author
Member

I've investigated this some more and it only happens when they global site configuration option for "Site Name in Page Titles" in the "SEO" fieldset under "Site" tab is set to something other than "no".

This is with the public beta 3 for 5.1.2

I've investigated this some more and it only happens when they global site configuration option for "Site Name in Page Titles" in the "SEO" fieldset under "Site" tab is set to something other than "no". This is with the public beta 3 for 5.1.2
Owner

The problem here appears to be related to Joomla itself. We are using setDocumentTitle, which is a core method in the view class. When it runs, if the title has a value, it respects the siteNamePageTitle configuration value:

  • If the value is 1, it prepends the site name and appends the title.
  • If the value is 2, it prepends the title and appends the site name.

This behavior matches Joomla’s documented implementation.

The challenge is that the JPAGETITLE language string is no longer present in the language files, which suggests this is actually a Joomla issue. If I remove the line where we set the document title, it behaves exactly like the article/content view does now. The core content views no longer use setDocumentTitle — they only set the title through the toolbar.

I initially thought using setDocumentTitle was the better approach, and therefore this is not a bug in our code. If anything, it is a Joomla bug since they dropped the JPAGETITLE language string.

So, we have two options:

  • Open an issue with Joomla regarding the missing JPAGETITLE string.
  • Remove our call to setDocumentTitle to follow Joomla’s current approach that only set the ToolBar Title.

This is ultimately a decision we need to make together. Joomla has made similar changes before, so we should decide whether to align with their new behavior or raise the issue upstream.

The problem here appears to be related to Joomla itself. We are using [`setDocumentTitle`](https://github.com/joomla/joomla-cms/blob/efb7789deb2ce55f5939b5adaa69d5626d7ee035/libraries/src/MVC/View/HtmlView.php#L585-L599), which is a core method in the view class. When it runs, if the title has a value, it respects the `siteNamePageTitle` configuration value: * If the value is `1`, it prepends the site name and appends the title. * If the value is `2`, it prepends the title and appends the site name. This behavior matches Joomla’s documented implementation. The challenge is that the `JPAGETITLE` language string is no longer present in the language files, which suggests this is actually a Joomla issue. If I remove the line where we set the document title, it behaves exactly like the article/content view does now. The core content views no longer use `setDocumentTitle` — they only set the title through the toolbar. I initially thought using `setDocumentTitle` was the better approach, and therefore this is not a bug in our code. If anything, it is a Joomla bug since they dropped the `JPAGETITLE` language string. So, we have two options: * Open an issue with Joomla regarding the missing `JPAGETITLE` string. * Remove our call to `setDocumentTitle` to follow Joomla’s current approach that only set the ToolBar Title. This is ultimately a decision we need to make together. Joomla has made similar changes before, so we should decide whether to align with their new behavior or raise the issue upstream.
Author
Member

Ok i did some more research and it looks like Joomla (not even in J3) used this method in the back-end and the language string is also not present even in J3.0.12 in the backend language files. So i believe best it to just remove it from the backend views. Joomla still uses this method in the front-end views tho even up to today.

I downloaded J4.0.0 and J5.0.0 and J3.0.12 packages to see what joomla did and if there was a JPAGETITLE present in the admin language.

Ok i did some more research and it looks like Joomla (not even in J3) used this method in the back-end and the language string is also not present even in J3.0.12 in the backend language files. So i believe best it to just remove it from the backend views. Joomla still uses this method in the front-end views tho even up to today. I downloaded J4.0.0 and J5.0.0 and J3.0.12 packages to see what joomla did and if there was a JPAGETITLE present in the admin language.
Author
Member

I checked a J3 component (jcb dev enviro) where i know this was working but there it calls setTitle from the Document Class. That function does not take into consideration any options for the page title, thus it works like we expect it to :D

I checked a J3 component (jcb dev enviro) where i know this was working but there it calls setTitle from the Document Class. That function does not take into consideration any options for the page title, thus it works like we expect it to :D
Author
Member

If we drop the setDocumentTitle all together we will be more consistent with the rest of the Joomla Backend since the building of the backend is different with the setDocumentTitle. The Toolbar method adds Administration to the end. Where setDocumentTitle does not. To see this in action open a custom admin view (which does not have the setDocumentTitle).

If we drop the setDocumentTitle all together we will be more consistent with the rest of the Joomla Backend since the building of the backend is different with the setDocumentTitle. The Toolbar method adds Administration to the end. Where setDocumentTitle does not. To see this in action open a custom admin view (which does not have the setDocumentTitle).
Owner

That might all be good and well — and it's true we didn't use this function in the past — but I intentionally moved toward using setDocumentTitle because it is not deprecated. It's a valid, supported function that is part of the API for that class, and it should work as expected.

I still believe that Joomla accidentally removed the JPAGETITLE language string without fully considering the implications. While that is the case, I agree we could work around this by creating our own method that loads a language string from our component's language file and behaves consistently.

Historically, as you mentioned, in Joomla 3 we used setTitle from the document class, but that method never took the site name into account — it only set the page title itself. That was not consistent with how Joomla handles site titles elsewhere (including in articles), so setDocumentTitle actually does the "right thing" by respecting the siteNamePageTitle setting and including the site name in the title.

For that reason, I would argue that using setDocumentTitle is the correct approach going forward. Joomla should ideally restore the missing language string or adjust the method so it continues to work as intended. If we want to be proactive, we could override setDocumentTitle in our view class, provide our own language string in our component, and get the correct behavior immediately. If Joomla later fixes the core method, we can simply remove our override and everything will continue to work.

That said, I'd like to wait a day or so to see if there's any response from Joomla before making a final decision. But I would encourage us to keep using setDocumentTitle, since it's part of the core MVC API, not deprecated, and was clearly intended to be used for this purpose.

Would @Lemuel or @TLWebdesign like to make a PR to Joomla to fix this?

That might all be good and well — and it's true we didn't use this function in the past — but I intentionally moved toward using `setDocumentTitle` because it is not deprecated. It's a valid, supported function that is part of the API for that class, and it should work as expected. I still believe that Joomla accidentally removed the `JPAGETITLE` language string without fully considering the implications. While that is the case, I agree we could work around this by creating our own method that loads a language string from our component's language file and behaves consistently. Historically, as you mentioned, in Joomla 3 we used `setTitle` from the document class, but that method never took the site name into account — it only set the page title itself. That was not consistent with how Joomla handles site titles elsewhere (including in articles), so `setDocumentTitle` actually does the "right thing" by respecting the `siteNamePageTitle` setting and including the site name in the title. For that reason, I would argue that using `setDocumentTitle` is the correct approach going forward. Joomla should ideally restore the missing language string or adjust the method so it continues to work as intended. If we want to be proactive, we could override `setDocumentTitle` in our view class, provide our own language string in our component, and get the correct behavior immediately. If Joomla later fixes the core method, we can simply remove our override and everything will continue to work. That said, I'd like to wait a day or so to see if there's any response from Joomla before making a final decision. But I would encourage us to keep using `setDocumentTitle`, since it's part of the core MVC API, not deprecated, and was clearly intended to be used for this purpose. Would @Lemuel or @TLWebdesign like to make a PR to Joomla to fix this?
Author
Member

I already added a issue and will do a PR to add the language string. seems the maintainers also agree it should be there.

I checked the code and it was never there at all. So it was not removed it just was never there.

Considering the consistency in the backend regarding page titles i really like to be able to not have the setDocumentTitle line in the prepareDocument in the backend. Be it with overrides or by default.

I want my component to behave as much as possible like the core Joomla. That way my customers have the most streamlined experience. If we purposely choose not to do that, i don't see a valid reason why.

Easiest fix is just to remove the setDocumentTitle. It fixes the issue and it streamlines the page titles to be in line with the rest of the Joomla Backend. So by removing unnecessary code we fix an issue and make it more in line with rest of Joomla. Seems line a no brainer to me, or am i missing something?

I already added a issue and will do a PR to add the language string. seems the maintainers also agree it should be there. I checked the code and it was never there at all. So it was not removed it just was never there. Considering the consistency in the backend regarding page titles i really like to be able to not have the setDocumentTitle line in the prepareDocument in the backend. Be it with overrides or by default. I want my component to behave as much as possible like the core Joomla. That way my customers have the most streamlined experience. If we purposely choose not to do that, i don't see a valid reason why. Easiest fix is just to remove the setDocumentTitle. It fixes the issue and it streamlines the page titles to be in line with the rest of the Joomla Backend. So by removing unnecessary code we fix an issue and make it more in line with rest of Joomla. Seems line a no brainer to me, or am i missing something?
Author
Member

You say it was clearly intended for this purpose. But it was clearly intended for this purpose for the front-nd part. Not the backend part. Because joomla itself doesn't actually use that function in the backend. And solely relies on toolbar set title. Which does the job perfectly fine.

You say it was clearly intended for this purpose. But it was clearly intended for this purpose for the front-nd part. Not the backend part. Because joomla itself doesn't actually use that function in the backend. And solely relies on toolbar set title. Which does the job perfectly fine.
Owner

After reviewing how Joomla handles this elsewhere, I’ve decided to drop this function call from the admin views. That way, our component will behave consistently with the other core Joomla admin views, even if that means accepting Joomla’s current inconsistencies rather than trying to “fix” them locally.

To be honest, I still believe this is a design issue in Joomla — the fact that the method works for site views but not admin views, and that different approaches are used between them, isn’t great practice. Ideally, the interface would either be polymorphic or this method wouldn’t be there at all.

But I’ve historically avoided “fixing Joomla” so I can stay focused on JCB, and I’ll stick with that approach here. If anyone wants to take this further upstream and improve Joomla, I’d be happy to see that happen! For now, this change will align our component’s admin view behavior with Joomla core, and we can move on.

After reviewing how Joomla handles this elsewhere, I’ve decided to drop this function call from the admin views. That way, our component will behave consistently with the other core Joomla admin views, even if that means accepting Joomla’s current inconsistencies rather than trying to “fix” them locally. To be honest, I still believe this is a design issue in Joomla — the fact that the method works for site views but not admin views, and that different approaches are used between them, isn’t great practice. Ideally, the interface would either be polymorphic or this method wouldn’t be there at all. But I’ve historically avoided “fixing Joomla” so I can stay focused on JCB, and I’ll stick with that approach here. If anyone wants to take this further upstream and improve Joomla, I’d be happy to see that happen! For now, this change will align our component’s admin view behavior with Joomla core, and we can move on.
Robot referenced this issue from a commit 2025-10-03 17:58:50 +00:00
Robot referenced this issue from a commit 2025-10-03 18:12:01 +00:00
Robot referenced this issue from a commit 2025-10-03 18:21:01 +00:00
Owner

@TLWebdesign this issue has been fixed. I have tested it and it works as expected.
I'm closing this issue as it has been resolved.

@TLWebdesign this issue has been fixed. I have tested it and it works as expected. I'm closing this issue as it has been resolved.
Robot referenced this issue from a commit 2025-10-15 20:35:52 +00:00
Robot referenced this issue from a commit 2025-10-15 20:57:03 +00:00
Robot referenced this issue from a commit 2025-10-15 21:07:33 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: joomla/Component-Builder#1255