Welcome to Geeklog, Anonymous Friday, March 13 2026 @ 01:41 am EDT

Geeklog Forums

COM_onFrontpage() does not detect top page if query parameters exist (gclid, utm, etc.)


Status: offline

ivy

Forum User
Full Member
Registered: 11/25/04
Posts: 319
Location:Tokyo Japan
I found an issue with COM_onFrontpage() in Geeklog 2.2.2.

When accessing the site with query parameters (for example from Google Ads or Google Analytics),
COM_onFrontpage() does not recognize it as the front page.

Example:
- https://www.example.com/ -> COM_onFrontpage() = TRUE
- https://www.example.com/?gclid=xxxx -> COM_onFrontpage() = FALSE

This causes problems when trying to display specific staticpage content on the front page,
since many ad/analytics URLs include parameters like gclid, utm_source, gad_source, etc.

Looking at the code in lib-common.php:

Text Formatted Code
$scriptName = rtrim(COM_getCurrentURL(), '/');
if ($scriptName == $_CONF['site_url']) {
$scriptName .= '/index.php';
}
...
if (($pos = array_search($scriptName, $homepageURLS)) !== false) {
$onFrontPage = true;
}
 



`$scriptName` includes the query string, so `array_search` fails.

---

**Proposed fix:**

Allow top-level URLs with query parameters to be recognized as the front page.

Text Formatted Code
if (($pos = array_search($scriptName, $homepageURLS)) !== false) {
$onFrontPage = true;
} else {
$parsed = parse_url($scriptName);
if (isset($parsed['path']) && $parsed['path'] === '/' && isset($parsed['query'])) {
$onFrontPage = true;
}
}
 



**Question:**
- Is this considered a bug or intended behavior?
- If it is a bug, can we include this fix (or something similar) in a future release?
Geeklog Japan https://www.geeklog.jp
 Quote

Status: offline

Laugh

Site Admin
Admin
Registered: 09/27/05
Posts: 1483
Location:Canada
I would have to look at the code and go through it more deeply but I would consider it an improvement or a bug.

Add it to Github so it could be looked into and to make sure the fix works with URL Routing and Rewrite.
One of the Geeklog Core Developers.
 Quote

All times are EDT. The time is now 01:41 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content