Copied to clipboard

Flag this post as spam?

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


  • Erik Vecchione 4 posts 72 karma points notactivated
    Nov 02, 2017 @ 19:05
    Erik Vecchione
    0

    Hello!

    Does Umbraco support the usage of route-based pagination instead of using query strings?

    I'm interested in setting up a routing pattern say for search results that would display as

    /search/search-term/page-number

    instead of

    /search?=search-term&page=1

    I've read through the documentation on custom routing and the web api and haven't seen anyone else using this.

    I understand I could set up a content finder/url provider script for this, but that seems to be a bit more overhead.

    Is this natively supported as a feature through one of the controllers?

    Thanks in advance!

  • Ben Palmer 176 posts 842 karma points c-trib
    Nov 14, 2017 @ 19:34
    Ben Palmer
    0

    Happy to be proven wrong on this but I'm pretty sure there's nothing like that out-of-the-box, your custom content provider would be the best bet as far as I know.

    The good news is that writing a custom content provider isn't all that difficult though!

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Nov 15, 2017 @ 09:09
    Dan Diplo
    0

    A simple option would be to use IIS URL Rewrites to provide this functionality. You can just add these to web.config

    I might not get the syntax quite right here off top-of-my-head, but something like this would probably work:

    <rule name="SearchPaging" stopProcessing="true">
      <match url="^(.*)/search/(.+)/(\d+)/$" />
      <action type="Rewrite" url="{R:1}/?search={R:2}&page={R:3}" />
    </rule>
    

    This would rewrite /search/search-term/1/ to /search?=search-term&page=1

    You might need to tweak and test, but that's the fundamentals.

Please Sign in or register to post replies

Write your reply to:

Draft