Hi,
I'm writing to report two major logic flaws in how SP Page Builder handles routing and publishing states, specifically regarding the new Collections architecture (dynamic view).
Issue 1: Unpublished Collection Items do not return a 404 error
When I set a Collection Item to "Unpublished" (or "Trashed") from the backend, it correctly disappears from the Addon grid. However, if a user or Google visits the direct SEF URL of that item, the page loads perfectly fine instead of returning a 404 Error.
Why this happens: It seems that the dynamic view controller relies on the status of the "Slug Page" (which is always published) but completely forgets to check the published state of the actual record inside the #__sppagebuilder_collection_items table.
Issue 2: SEO Duplicate Content (Orphan URLs)
SP Page Builder routing allows the same collection item (or standard page) to be loaded via multiple URLs.
If the correct URL is domain.com/menu-category/item-alias, a user can simply strip the menu path and visit domain.com/item-alias. Instead of throwing a 404 or doing a 301 redirect to the canonical URL, SPPB uses a fallback to the Homepage Itemid and loads the page anyway. This creates massive Duplicate Content issues for SEO.
Our temporary workaround:
To protect our clients' SEO, we had to write a custom Joomla System Plugin using the onAfterRoute event.
Our plugin intercepts requests where option=com_sppagebuilder, checks if view=dynamic, reads the collection_item_id, and queries the #__sppagebuilder_collection_items table directly. If the state is != 1, it forces a throw new \Exception(..., 404);. We also added logic to prevent the fallback to the default Itemid, forcing a 404 on short/orphan URLs.
Question for the Devs:
Are you aware of these routing/publishing bypass issues? Can we expect a native core fix for the dynamic view controller in the upcoming updates so that unpublished items actually return a 404 natively?
The plugin I created works on any site; I named it sppb404fix.
As I explained, it makes no sense for collection content to remain accessible via its alias (SEF URL) after it has been unpublished.
For now, I have tested the plugin on a couple of websites; let's see if I encounter any issues on others.
Thanks!