[英]Expression Engine 3 pagination with page_uri
I have looked for a while for a solution to this, but have been unsuccessful so far. 我已经寻找了一段时间来解决此问题,但到目前为止仍未成功。 Not sure if it's me, or if there's a problem with the pagination functionality. 不知道是我还是分页功能是否有问题。
What I'm trying to do 我想做什么
When on a page within a certain channel, I want to have 'prev' and 'next' buttons to click through to the next article in the channel. 当在某个频道内的页面上时,我想要具有“上一个”和“下一个”按钮以单击以转到该频道的下一篇文章。 These links must use the page_uri set for each page. 这些链接必须为每个页面使用page_uri设置。
What I've tried 我尝试过的
I have a channel full of pages. 我的频道充满了页面。 In the template, I have added: 在模板中,我添加了:
{exp:channel:entries channel="project" dynamic="no" orderby="date" sort="desc" limit="1" paginate="bottom"}
<div class="container-fluid project-section pagination-bar">
<div class="container">
<div class="col-md-12">
{paginate}
{pagination_links}
<ul>
{previous_page}
<li><a href="{pagination_url}" class="page-previous">Previous Page</a></li>
{/previous_page}
{next_page}
<li><a href="{pagination_url}" class="page-next">Next Page</a></li>
{/next_page}
</ul>
{/pagination_links}
{/paginate}
</div>
</div>
</div>
{/exp:channel:entries}
This is adding the links to the bottom of the page, but when clicking on them the URLs are just loading the same URL you're currently on, then adding /P1 to the end. 这会将链接添加到页面底部,但是单击它们时,URL只会加载您当前使用的相同URL,然后在末尾添加/ P1。
I need it to use the page_uri added in the CMS so that it clicks through properly and doesn't affect SEO on the site. 我需要它使用在CMS中添加的page_uri,以便它可以正确点击并不会影响网站上的SEO。
Any help appreciated on this one, thanks 感谢任何对此的帮助,谢谢
Pagination isn't really the way around this. 分页并不是解决此问题的真正方法。 You should look into Next/Previous Entry Linking . 您应该查看下一个/上一个条目链接 。 It'll give you a full link to the previous and next entry. 它会为您提供指向上一个和下一个条目的完整链接。 Just make sure to keep it outside your channel entries loop. 只要确保将其保持在频道条目循环之外即可。
For example you'd want something like: 例如,您想要以下内容:
{exp:channel:prev_entry channel="project"} <a href="{path='projects'}">View previous project</a> {/exp:channel:prev_entry} {exp:channel:next_entry channel="project"} <a href="{path='projects'}">View next project</a> {/exp:channel:next_entry}
Assuming your projects all live in a section called projects you'd be linking between 假设您所有的项目都位于一个名为“项目”的部分中,
/projects/example-project-1 / projects / example-project-1
/projects/example-project-2 / projects / example-project-2
/projects/example-project-3 / projects / example-project-3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.