Copied to clipboard

Flag this post as spam?

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


  • Tony Kiernan 278 posts 341 karma points
    Jan 09, 2014 @ 12:38
    Tony Kiernan
    0

    UrlRewriting 'nice' pagination

    I have a number of pages that will be using pagination.  I want to ne able to use something like

    ~/somepage/1/

    to give me

    ~/somepage/?page=1

    I've tried this

        <add name="paging"
          virtualUrl="^~/([0-9]+)$/" 
          rewriteUrlParameter="ExcludeFromClientQueryString"
          redirectMode="Permanent"
          destinationUrl="~/?page=$1"
          ignoreCase="true" />

    Which is not working at all

    Oh, AND, by child pages will have the url

    ~/somepage/somechildpage/
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 10, 2014 @ 07:22
    Fuji Kusaka
    0

    Hi Tony,

    You dont need to change the config to make a paging the way you want. To be more precise you can actually have different paginator on different sections of your website with either ~/somepage/?page=1 or even ~/someotherpage/?somepage=1.

    Anyways for this you will need to create eithere razor file where you will make a loop through the section you want to make the paging.

    This url might help  you .

    http://www.diplo.co.uk/blog/2011/6/21/creating-a-paged-list-in-umbraco-using-razor.aspx

    Hope this helps.

    //Fuji

  • Tony Kiernan 278 posts 341 karma points
    Jan 10, 2014 @ 10:44
    Tony Kiernan
    0

    No, it doesn't.  I knowe how to do the paging.  I was asking how to make the Urls 'nicer' using UrlRewriting

    NB. I don't need to do this any more, but would still beinterested if anyone has ideas. 

    I can work it with a seperate config entry for each page, if the articles are not child nodes.  But, would like to use one generic entry that copes with the articles as children

  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 10, 2014 @ 10:58
    Fuji Kusaka
    0

    what url is being displayed in your address bar atm ?

    Did you change st the umbracoUseDirectoryUrls to true in the web.config ? Or am i misunderstading what you are looking to achive here.

  • Tony Kiernan 278 posts 341 karma points
    Jan 10, 2014 @ 11:54
    Tony Kiernan
    0

    Completely.  Using UrlRewriting the adress can read

    http://yourdomain.com/somepage/1/

    And return

    http://yourdomain.com/somepage?page=1
  • Fuji Kusaka 2203 posts 4220 karma points
    Jan 10, 2014 @ 12:03
    Fuji Kusaka
    0

    So basically you only need to add another forward slash before the query string in the url right ? 

    Weird if you have set the <umbracoUseDirectoryUrls> to "true" it should add a trailing slash to the url

  • Tony Kiernan 278 posts 341 karma points
    Jan 10, 2014 @ 12:06
    Tony Kiernan
    0

    No, you are completely missing what I'm asking.  Slashes are irrelevant. 

    Setting the rewrite to work means I cannot access the child pages properly.

    Also, I am looking for a generic way to write it so it don't have to write a new one for each 'somepage' value

  • Tony Kiernan 278 posts 341 karma points
    Jan 10, 2014 @ 12:07
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies