title = "Blog Post" url = "/blog/post/:slug" layout = "blog" is_hidden = 0 [viewBag] localeUrl[gr] = "/blog-post" [blogPost] slug = "{{ :slug }}" categoryPage = "blog/blog-category" [blogCategories] slug = "{{ :slug }}" displayEmpty = 0 categoryPage = "blog/blog-category" [searchInput blogSearchInput] useAutoComplete = 1 autoCompleteResultCount = 5 showProviderBadge = 1 searchPage = "blog/search-posts.htm" == categories->pluck('id')->toArray(); // Here you need to pass it as we are // hardcoding category slug in URL so we have no data of category // IF YOU DONT WANT CAT COME FROM POST // YOU CAN HARD CODE THEM $postCats = ['2'] // here 2 is id of category // use this cats to scope $nextPost = $post->isPublished()->applySibling(-1) ->FilterCategories($postCats)->first(); // check if next is not availabe then return false if(!$nextPost) { return false; } // create page link here same page $postPage = $this->page->getBaseFileName(); // set URl so we can direct access .url $nextPost->setUrl($postPage, $this->controller); // set Cat URl so we can use it directly if needed $nextPost->categories->each(function($category) { $category->setUrl($this->categoryPage, $this->controller); }); return $nextPost; } public function previousPost($post) { // get current cats $postCats = $post->categories->pluck('id')->toArray(); // IF YOU DONT WANT CAT COME FROM POST // YOU CAN HARD CODE THEM $postCats = ['2'] // here 2 is id of category // use this cats to scope $prevPost = $post->isPublished()->applySibling(1) ->FilterCategories($postCats)->first(); // check if nprevious ext is not availabe then return false if(!$prevPost) { return false; } // create page link here same page $postPage = $this->page->getBaseFileName(); // set URl so we can direct access .url $prevPost->setUrl($postPage, $this->controller); // set Cat URl so we can use it directly if needed $prevPost->categories->each(function($category) { $category->setUrl($this->categoryPage, $this->controller); }); return $prevPost; } ?> == {% if post.featured_images.count > 0 and (this.theme.blog_post_pageheader == 'post' or this.theme.blog_post_pageheader == 'both') %} {% partial "blog/postheader" %} {% else %} {% partial "blog/pageheader" %} {% endif %} {% set size_1 = this.theme.blog_post_size %} {% set size_2 = 12 - size_1 %}