Skip to main content

Pros and Cons of Semantic URLs

Semantic URLs have some great benefits. The most obvious one is SEO-friendliness (search engine optimization - Google simply likes semantic URLs better). Not only that but users tend to prefer semantic URLs when they come up in search results.

However, assume for a moment that you're the user and you want to re-post a specific article...is it really a net benefit to make a longer URL like: http://www.dogs.com/articles/wiener-dogs-do-super-cute-things-when-you-play-with-them versus http://www.dogs.com/articles/158? You may have made a trade-off here: SEO-friendliness versus ease of use. As a user, you probably already know the URL you are looking for, so that part is easy. You probably can guess that articles are under "/articles", so that part is easy as well. So sometimes it comes down to which is easier to use - a super-long article "slug" or a simple number. Ask yourself what happens when you want to send the link via text or Twitter or some other text messaging service/ You're probably going to appreciate a shorter link so you don't have to plug the URL into a URL-shortener service like bit.ly in order to keep your message brief.

Of course, the disadvantage may lie in the fact that numbers are not obvious. If you read a lot of articles on a particular site, you will have a lot of numbered links in your history to contend with. Good luck finding that one article you saw about super-cute wiener dogs when you have a bunch of similar links with article numbers! That said, you could always bookmark a page you like and call it whatever you want (which is actually the preferred behavior, but I digress...).

Ultimately, you need to be smart about your semantic URLs. Realize that search engines are NEVER going to be able to index any pages behind a login, so for sure you don't need semantic URLs there. Realize as well that super-descriptive URLs may not be helpful to your user in some cases where the URL may get shared. Also consider that if you aren't a really popular website that publishes a bunch of daily content, it really may not help much to be very descriptive. Also, you're going to need some additional code to check that your descriptive strings are unique and generate a new one if it isn't. Also, storing a long article "slug" means using more storage in your database.

I'm not saying semantic URLs should never be used. They are definitely appropriate for certain sites and circumstances. Just realize that they are not a panacea and you may actually be shooting yourself in the foot when you insist on using them for every situation.

Comments

Popular posts from this blog

jQuery noUIslider Pip Label Customization

Recently, I was tasked with creating a slider element for a user to select their credit rating, of which the user can select from among: 'Poor', 'Fair', 'Good', 'Excellent' and 'Not Sure'.  Several problems presented themselves here: A drop-down box would be better, but that's not what the requirements specified. I already have several numeric sliders on my page and I want them all to match. I selected the jQuery noUi Slider library to create the numeric sliders. noUi Slider does not support string values - only numeric values. The "pips" (slider scale/labels) also does not support string values. Since the solution involved shifting my mindset, I wanted to document it here for future reference and maybe to help someone facing the same requirements. Here's my solution: Since there is really no numeric correlation to credit score (especially considering one of the options is "Not Sure"), I will just u

How to Create a new Case Record Type in Salesforce

Here are the specific steps for adding a case record type. Some steps may vary by organization but the process should be pretty similar to what is shown here. 1) Create a new page layout 2) Add any new case statuses to picklist 3) Edit case statuses that should indicate case is "closed" 4) Add any new case types to picklist 5) Add any new case reasons to picklist 6) Add any new case origins to picklist 7) Add any new fields to case object 8) Under Record Types, ensure the picklists have the correct values (i.e. - Reason/Type/Origin) 9) Within the Type field, edit "Reason" field dependencies matrix and add new reason(s) to types 10) Create a new support process (if not reusing an existing one) 11) Create the new record type (enable for all profiles) 12) Finalize the page layout (if needed) and check "Default" in Case Assignment checkbox under Layout Properties 13) Create approval queues (if needed) 14) Set up approv

View Helpers - Custom Output Parser

I was reviewing some blade view code recently and decided it was too verbose. There were some long output statements that were duplicated throughout the view and that always signals a need to refactor or come up with a better method. So I wanted to share (or at least document) what I came up with here. First, the issue: fields stored as boolean "0/1" in the database must be output in "Yes/No" format. Plus, if the field is blank (or null), that must be reflected as well. Add to that the uncertainty of whether the production Microsoft Azure database will return a string or integer value for 1 or 0. This problem necessitates a blade statement like: {{ $object->property === null || $object->property === "" ? "" : $object->property == 1 ? 'Yes' : 'No' }} Like I said...verbose! One solution might be to create a Laravel accessor for the boolean field in the model. But that would mean that if I want the actual boolean