Skip to main content
Logo

What is routing?

This series of articles shows you how to implement routing on a Contensis published application where routing isn't natively supported.

Prerequisites

These articles assume that you have some basic knowledge of the programming concepts such as functions method and classes.

It also assumes you have some familiarity with developing in Contensis using our Delivery API and razor views.

Routing overview

When building applications, routing, refers to defining a set of URLs to render content that isn't tied to a physical page/file, such as entries created using content types in Contensis.

You may have seen URLs like this: https://www.application.com/movies/movie.aspx?id=4, where the query string parameter is used to determine which movie to render. Usually this is achieved by matching the ID to a record in a database to return and display the content.

URLs formatted in this way make sense to developers, but not to users or search engines. Ideally, your application should use human readable URLs. These allow users and search engines to navigate your application effectively and more easily understand your content.

Why routing?

Clean URLs make it easier for people to know where they are within your application and if they want they can navigate by adding or removing parts of the URL.

Human readable URLs help search engines to tell users what your content relates to. Even if the title tag is missing or not well written, for example. Search engines can always return relevant information about your content and help people get to it quickly.

There is also a benefit in a social media/sharing context. URLs that give users more information on what the content being shared is about, make people more likely to click on a link.

Clean URLs

Implementing routing cleans up your URL so this:

https://www.application.com/movies/movie.aspx?id=4 

becomes this:

https://www.application.com/movies/movie-title 

Routing also gives you the flexibility to implement URLs that group a collection of content together. In the case of movies, this could be by release date:
https://www.application.com/movies/{year}/{month}

or by genre:

https://www.application.com/movies/{genre}

You can then link to a specific piece of content by adding a unique identifier, usually the title of the content, to the URL e.g https://www.application.com/movies/{genre}/{movie-title}.

In this example, an actual URL might look like this: https://www.application.com/movies/sci-fi/star-wars-return-of-the-jedi

When implementing routing, we strongly recommend that you consider user experience, effect on SEO and any documented information architecture.