In J4, I have a menu item (in main menu) loading a single article and I've added a unique class via the menu Page Display >> Page Class.
It has an alias of "commercial" and when used from the front end the URL is /commercial
.
I have created another menu with a menu item that is an alias item pointing to the above menu item. The alias on this menu item is "commercial-info".
However, when visiting the link on the front-end, the page class is not used and the URL is /?itemid=223
(the id number of the alias menu item (not the one it points to).
Also, the <body>
gets a class added no-layout no-task dir-ltr itemid-233
(as well as a number of other miscellaneous classes added).
(updated)
The custom module that is creating the links is building the links using this code:
$menuItemURL = Route::_("index.php?Itemid={$menuItem->id}");
So the question is, how can I get the REAL URL using Route::_
when the menu is an alias? (The above Route::_
works fine for all other menu types other than alias).