Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
Hello Couch friends,

I am trying to find a way to add a "next" and "Previous" blog post buttons on cloned pages.
So basically they are buttons that would be in every blog post (Cloned page), that take you to the next or previous Blog post (cloned page) in a set of cloned pages from a template.

I'm still pretty new to CouchCMS, but am looking forward to use it alot in the future. Basically i would need a variable similar to "k_paginate_link_next", except for an individual blog post (cloned page).

Can anyone enlighten me?
:?:
How do you want blog posts ordered? If by publish date - 2 same publish dates can't guarantee a definite order. If by page_id - then essentially, you need to find `next` and `previous` page_id. This task I solved here viewtopic.php?f=8&t=10169 in custom request to database with cms:query. It can be easily adapted to your needs. :)
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Basically i would need a variable similar to "k_paginate_link_next", except for an individual blog post (cloned page).


Another solution is to list your blog post with cms:pages, limit='1' paginate='1' and add
<cms:paginator simple='1' /> to display Prev Next links. I guess, this is the right solution for your request.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
trendoman wrote:
Basically i would need a variable similar to "k_paginate_link_next", except for an individual blog post (cloned page).


Another solution is to list your blog post with <cms:pages, limit='1' paginate='1' and add
<cms:paginator simple='1' /> to display Prev Next links. I guess, this is the right solution for your request.


Hey Trendoman, thanks alot for helping out! I just saw the first solution you recommended, and wow that is awesome that you came up with all that, but i'm wanting to add these links on the front end so users that are actually reading the blog posts can move to the next and previous published posts.

I really liked the more simple second method, i'm going to go ahead and try this and will be back to tell you how it worked, much appreciated Trendo!
Another solution is to list your blog post with <cms:pages, limit='1' paginate='1' and add
<cms:paginator simple='1' /> to display Prev Next links. I guess, this is the right solution for your request.
This would certainly work but a 'side-effect' would be that the URL displayed in the address bar would never show the canonical URL of the page being visited (e.g. http://site.com/blog/some-page.html). Rather it would always show the URL of the list-view with pagination info appended (e.g. http://site.com/blog/?pg=2).

There are other methods of adding the next/prev buttons on individual pages.
Please see viewtopic.php?f=2&t=21

More are discussed here -
viewtopic.php?f=8&t=7087

Hope it helps.
5 posts Page 1 of 1