j127 reported a bug where private forum topics returning 403 Forbidden status codes were incorrectly labeled with the title “Page Not Found” in analytics tools like Google Analytics. This occurred even when the detailed_404 setting was enabled, which changed the status code but not the page title. j127 argued that the title should reflect the need to log in (e.g., “Please log in to view this page”) to prevent data distortion and improve user experience for those clicking private links from email digests.
The issue was fixed in PR #46916, which initially changed the 403 title to “Access Denied”. However, Moin noted that this title casing violated Discourse’s style guide, which mandates sentence case (“Access denied”) to preserve existing translations. sam agreed, and meta-bot updated the fix in PR #46951 to use “Access denied” and reuse the correct translation key.
Further review by sam and martin highlighted that other error messages also lacked consistent sentence casing. To ensure uniformity, meta-bot expanded PR #46951 to standardize client error reasons, updating titles like “Network error,” “Server error,” and “Page not found” to sentence case. The changes were confirmed to pass linting and translation checks. Moin commended the approach of updating small portions at a time to manage the workload for translators.
I just noticed a lot of page titles in Google Analytics that start with “Page Not Found”. I investigated for a while and it turns out that they are private forum topics that are sending 403 status codes to search engines.
I think that those pages should have a different page title so they don’t show up in analytics when people search for URLs that have the title “Page Not Found”. The pages were found, but the visitor just needs to log in.
The message on the pages themselves says: “Oops! That page is private.”
I think something like “Please log in to view this page” would be a better <title> for those pages when the settings allow anonymous visitors to see that private pages do exist.
Yes. It isn’t actually a 404 when that setting is on though — checking the box changes it to a 403. I think that the <title> should conditionally reflect that, or it distorts analytics reports.
GA4 defaults to showing page titles in reports instead of paths/URLs, and the 403s are being listed as “Page Not Found”, which isn’t correct. It should be something like “Log In to View This Page”.
The reason I want that setting on is because the email digest contains links to private topics and if people click on those and they don’t see a message that they need to log in to view the page, they will probably bounce.
While looking at the 403 page with that setting on, I noticed that the site name is missing. I’m not sure if that’s just my site or if it’s a Discourse bug, but I see the problem on two different Discourse forums.
After looking more at that 403 page now, I’m thinking it would be better if it had a call to action there, like “Log in to view this page” with log-in/sign-in buttons. If the user then logs in and doesn’t have access, then it could say “Oops! That page is private.” That way they would know that logging in might unlock the page.
(In the meantime, I’m seeing if I can customize that in the theme.)
Good catch, @Moin. It wasn’t meant to be an exception. PR #46951 changes the 403 title to “Access denied” and reuses the existing translation key instead of keeping a separate one. The 404 title is unchanged.
The focused request specs and lint checks passed locally. CI is running.
Updated PR #46951. All five client error reasons now use sentence case: “Network error,” “Server error,” “Access denied,” “Error” (already correct), and “Page not found.”
The 403 page still reuses the existing “Access denied” translation key. The server-rendered 404 title is unchanged. YAML validation and translation lint passed; CI is running on the updated PR.