How to Layout Your URLs, Don't Get Lost in the (Content) Trees

By Jordan Whiteley On February 17, 2020

How to Layout Your URLs, Don't Get Lost in the (Content) Trees
Planning out your site's URL structure when you’ve got a CMS to drive can be fairly nuanced if you want to give your sales and SEO folks a great finished experience. But why? We here at BizStream get a pretty even share of clients coming to us for new projects and clients coming with their existing site for help. In the latter, we see a lot of what we (nicely) consider odd design decisions. When asked why they did something some way, I often cringe when the sole answer is, "Well we had a consultant that insisted that we needed this for SEO". SEO is one of those opaque concepts that people can pull out to explain a bad decision. No one can really call them out on it because it's an untestable concept, you can only change the subject to point out that SEO is untestable and then you're off in the weeds and everyone in the meeting pulls out their phones.

Recently I've been hit with three different projects that handled URLs and routing differently, they all were doing it "For the SEO!". That sounds like it's time to take a step back and review the current state of the web.

Selling Over SEO

The first thing I want to get out of the way is that SEO is often the main topic of discussion in these blog posts. While making Google happy with your site is a good priority, our first priority should always be making our customers/clients happy. You need to really look at the business and who your target market is. If it’s truly online only, then SEO considerations should take a high priority, but consider how your company truly does business.  

Consider that you have a sales department that’s going face to face with your target market. They’re going to sell them on visiting the website and clicking that buy button. How happy is your sales guy going to be trying to convince vs It’s already pretty obvious visually that one is going to be easier than the other, but really take the time to say it in your head like a sales rep would to a customer, “Website dot com slash N A for North America than E N dash U S slash product dash category slash …” That’s what I’d call a high friction sale right there. Instead, you’d want to have your sales guys saying, “Check out the product on website dot com slash product slash widget.” That’s a much easier task to type and much easier to remember. One sticks in a customer's head and the other puts them to sleep.

Another consideration, do you send your sales/marketing out to trade shows or have booths at a convention? Do you print marketing materials to hand out? You’re going to want URLs that are easy to look at and type. Even past the in-person sales pitches, do you use billboards or run radio spots on Spotify/Pandora? How your url sounds when you say it is going to be vital to closing sales and actually making your company real money.

It’s very easy for us computer nerds building websites to get caught up in the digital side of things and forget that the business that we’re working for probably exists in the offline world as well.

SEO Is Still Important

So all that said, SEO is still very important, but it’s also important to really consider the current state of SEO. Long gone are the days when Google would reward you for packing a URL full of marketing keywords. Check out the currently listed recommendations for SEO and URLs:

URL Structure:

There’s a lot to unpack in the above links, however, the summary would be, “Keep it short, keep it to the point.” Avoid excessive nesting and non-human readable codes in your URL, if possible. Use your page title or a portion of it in your URL if possible. If this strangely sounds a lot like what your sales team really wants, that’s probably no coincidence. The best rule of thumb when doing anything for SEO is to follow Wheaton’s Law, Don’t be a... jerk. Make something your users want to consume and Google and the rest of your company will be happy with you. Keeping it concise is especially important in optimizing the amount of data your mobile users will see in the address bar.

Don’t Forget The Content Editor!

All this talk of sales and customers does leave one very important person out of the equation, and that’s the ever-important person tasked with producing and organizing all of this content. Simple URL structures are all well and good until you’ve got a content tree with 10,000 product nodes all sitting in a single folder of the root of your tree. It’s flat out unmanageable and a performance disaster waiting to happen. We need a solution that passes the following metrics.

Your content editors need to...
  • Have the ability to keep things organized without messing up a URL structure.
  • Be able to have meaningful nesting (ex: products are nested under their category).
  • Have the ability to break the rules when needed.

How to Set This up in Kentico EMS

The final person we consider here is the developer that needs to head out and actually implement this. As a tech lead, knowing about the deep intricacies of the MVC request pipeline is a given, however, we need a solution that our less experienced devs can use as well. The general pattern of this solution is to make sure you specify a well-formed URL pattern on the page type, then implement that pattern in your MVC controllers.

Basic Scenario

The first example I’ve got here is for a pretty basic named page. In Kentico we want to set up our URL pattern like the following: 

/product/{ % NodeAlias.ToLower() %}

Keep in mind that we normally want to force all of our URLs to lowercase so be sure to spend time here to get this correct.

Example of setting our url pattern to include the parent product category node alias

Also, it’s good practice to have a Title field that you use as your page alias source field (you can set this in the fields tab). When this is configured correctly we’ll have the ability to nest your products wherever you want in the content tree without creating an unwieldy URL that your sales department will hate.

On the back end in you will need your tech lead to set up a node alias route constraint (which probably deserves its own blog post), but then it’s as simple as using it on the controller action and creating the query by node alias code.

code snippet

Pretty Scenario

The above scenario is great if you have products with distinct names, but you can only use it for situations where you’re confident that you aren’t going to have two legitimate nodes in the content tree, in different places, named the same thing. Also, hard coding the word ‘product’ in there can be a bit of wasted URL space and we can do better. Let’s get the parent product category page in there.

First up, in Kentico we want to make sure that the only place we can add a product page is under a product category.

Image of parent product category page

Next up we want to set our URL pattern to include the parent product category node alias.

/{ % Parent.NodeAlias.ToLower() @%}/{ % NodeAlias.ToLower() @%}

Example of setting up url pattern

Then finally, in our MVC application, we want to set up our controller to accept both node aliases and update the repository to also require the proper product/category combination:

code snippet

This changes up the URL to give your sales team the ability to go from to the superior Your content editor also gets to set the word ‘mens’ at runtime in your application.

The other obvious benefit is that you can place your product categories right at the root level of your URL without forcing a content editor to clutter up the root of the content tree. Keep those tucked away in a nice folder and keep the people writing your all-important content happy.

Rule Breaking Scenario

Sometimes you want to keep things structured, and sometimes you want your content editors to have full control. In these situations, you should just give the content editor full control by routing based on the node alias path. In Kentico it looks like this:

/{ % NodeAliasPath.ToLower() @%}

Example of routing based on the node alias path

Let your content editor know they have full control here and to be careful. In the MVC application, you’ll need a very slightly different route constraint, but in general, it should look like this.

code snippet

A general rule of thumb here is that you want to keep the types of pages like this to a minimum though. While it may seem to make a lot of sense to a content editor, they’re the ones staring at the full content tree all day. From a sales, marketing, dev, and SEO perspective it’s often the wrong call.

Keep a solid simple structure, and keep your print, audible, and digital mediums happy. It’ll help build a solid foundation for your next web project.
Click here to read more Kentico posts
Start a Project with Us
Photo of the author, Jordan Whiteley

About the author

Jordan is a low key guy with the drive to learn about software architecture, functional programming, and web automation. He’s been into computers since the day his uncle gave him his old commodore 64. He even chose to buy his own computer instead of a car when he turned 16. Currently, he enjoys being a Lego robotics coach for middle schoolers, playing Super Nintendo, taking walks in the woods, and snuggling on the couch with his 3 kids and 2 cats.

View other posts by Jordan

Subscribe to Updates

Stay up to date on what BizStream is doing and keep in the loop on the latest with Kentico.