Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • nic 7 posts 87 karma points
    Oct 13, 2013 @ 12:48
    nic
    0

    Get Previous and Next Url

    hi there

    i am new to umbraco and am trying to retrieve the urls for the next and previous pages to a given page.

    i am attempting to do this in the template, my current code is

    it doesn't like Model.Next

     

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage

    @using SiteModel.Helpers

    @{

        Layout = "_Layout_Master.cshtml";

        string fileUrl = Model.Content.GetImageUrl();

    var rd = Model.Content.GetPropertyValue<DateTime>("releaseDate").ToString("dd/MM/yyyy");

    var m = Model.Content.Name;

    var url = Model.Content.Url();

    Model.Next();

    }

     

    cheers

    Nic

     

     

  • Ali Sheikh Taheri 470 posts 1647 karma points c-trib
    Oct 13, 2013 @ 13:01
    Ali Sheikh Taheri
    1

    Hi Nic,

    Welcome to Umbraco Forum.

    you should use Model.Content.Next()

    Hope that helps

    Cheers

    Ali

  • nic 7 posts 87 karma points
    Oct 13, 2013 @ 13:19
    nic
    100

    Hi Ali

    Thanks very much for that

    cheers

    Nic

  • Ali Sheikh Taheri 470 posts 1647 karma points c-trib
    Oct 13, 2013 @ 13:27
    Ali Sheikh Taheri
    0

    you are welcome

  • Ankush Jain 1 post 71 karma points
    Nov 29, 2018 @ 12:25
    Ankush Jain
    0

    To get previous & next page URLs in Umbraco, you can use below piece of code in your razor view.

    @if(CurrentPage.Previous() != null){
           <a href="@CurrentPage.Previous().Url">Previous</a>
    }
    
    @if(CurrentPage.Next() != null){
           <a href="@CurrentPage.Next().Url">Next</a>
    }
    

    Fore more detail vist - http://coderjony.com/blogs/get-previous-and-next-page-urls-in-umbraco/

Please Sign in or register to post replies

Write your reply to:

Draft