navigation links are generated incorrectly
Is there a reason why you use the property &pageLinkScheme
in the pdoPage call?
To better understand the problem:
- What is the
url
(oralias
) of your resource that contains the pdoPage tag? (The URL you see when you view the page without a page parameter.) - How exactly do you want the page navigation URLs to look like, that the pdoPage snippet returns?
- What versions of MODX and pdoTools are you using?
no modifications, clean install of MODX, installed PDOtools, trying to replicate behavior from official documentation
https://docs.modx.com/3.x/en/extras/pdoTools/Snippets/pdoPage#friendly-urls-pagination
The thing is, that I can’t reproduce your problem.
On MODX 3.0.3-pl with pdoTools 3.0.2-pl I created a page with the alias testpage
(and the URL mydomain.com/testpage/
) and with the “Container” flag (isfolder
) set to true
.
This call on the page
[[!pdoPage?
&parents=`5`
&limit=`1`
&pageVarKey=`page`
&pageLinkScheme=`[[+pageVarKey]]-[[+page]]`
&tpl=`@INLINE {{+pagetitle}} ({{+id}})`
]]
<hr>
[[!+page.nav]]
produces this page navigation which is correct.
<ul class="pagination">
<li class="page-item disabled"><span class="page-link">First</span></li>
<li class="page-item disabled"><span class="page-link">«</span></li>
<li class="page-item active"><a class="page-link" href="testpage/">1</a></li>
<li class="page-item"><a class="page-link" href="testpage/page-2">2</a></li>
<li class="page-item"><a class="page-link" href="testpage/page-3">3</a></li>
...
</ul>
So what are your specific settings that cause the issue? Do the friendly URLs work correctly when you view the pages of your site?
try go to page “testpage/page-3”
and check navigation list again
yes, FURLs works correctly
I believe the preg_quote()
in this line of the code is wrong.
Check if it works, when you replace the line with
? preg_replace('#' . $pcre . '#', '', $url)
instead.
If this solves the issue, then please open an new issue on Github so it can get fixed.
thanks, it’s work for me
I can confirm this issue and can also confirm the suggested fix here works. Unfortunately I did not see an issue opened on github so I’ll try to do that myself now.
UPDATE: issue opened here now: Incorrect Friendly URLs with pagination when using pdoPage · Issue #370 · modx-pro/pdoTools · GitHub