Closed stanislavprokopov closed 7 months ago
This is how craft is handling page detection, so added this to Node._getActive
, seems like its working.
// Is this a paginated request?
$pageTrigger = Craft::$app->getConfig()->getGeneral()->getPageTrigger();
// If this is not query string-based pagination, then need to cleanup currentUrl
if (!str_starts_with($pageTrigger, '?')) {
// Match against the entire path string as opposed to just the last segment so that we can support
// "/page/2"-style pagination URLs
$pageTrigger = preg_quote($pageTrigger, '/');
if (preg_match("/^(?:(.*)\/)?$pageTrigger(\d+)$/", $currentUrl, $match)) {
$currentUrl = $match[1];
}
}
Good point, hadn't actually considered using non-query string pagination. Updated for the next release. To get this early, run composer require verbb/navigation:"dev-craft-4 as 2.0.24"
.
Fixed in 2.0.25
Describe the bug
When using paginate tag, the urls that it generate look smth like
https://domain/{slug}/page/2
, when you navigate to this page, and then try to usecraft.navigation.getActiveNode
it will return you null, asNode._getActive
does not handlepage/x
in any way so it fails to find active node.Steps to reproduce
config/general.php
add->pageTrigger('page/')
, see manualtest
, with oneSite Url
with URLtest
verbb\navigation\elements\Node
active nodenull
Note: This is a simple example that achieves the same result without actually setting up collection and using paginate tag to query elements
Craft CMS version
4.5.14
Plugin version
2.0.24
Multi-site?
Yes
Additional context
No response