You are visiting the High Monkey blog archive. Posts prior to 2016 may not meet accessibility standards. Please visit our current blog area at https://www.highmonkey.com/blog to view accessibility compliant blog posts published since January 1, 2016.

Keeping Development Simple

Kentico Navigation Customization

Written By: Chad Heinle
Posted: 3/20/2013

The Problem

While building our new website (highmonkey.com) within Kentico CMS 7 (product placement) - we were faced with a technical problem of adding anchor links into the local navigation because we decided to use a long page with sub-navigation that took users to a specific section on the page rather than loading separate pages. This presented a challenge because navigation items within Ketnico are traditionally separate pages.

Letting the developer in me win

By trade, I am a developer, so at first, my programming brain took over. I immediately opened Visual Studio and began scouring the navigation web part user control for a hint on how to add code that could read through the page, pick out the anchors and add them to the navigation automatically. I did not succeed in Visual Studio.

Next, I turned to jQuery, where I found what I thought was a successful solution. I successfully built jQuery that could read through the page content, pick out each anchor tag and append it to the current navigation item as sub-nav. Problem solved! Or was it? As I was implementing the solution I realized another problem; not all of the sub-nav links are anchor links. One of the links is actually supposed to navigate to another page, not an anchor tag. No anchor tags and no way for jQuery to easily read the previous page to build the sub-nav. Back to square one.

Keep it simple

My options seemed to dwindle, but I knew there had to be another solution. As I pondered potential solutions I recalled the URL redirection functionality that I had initially avoided. In the options available for Page items (which can translate into navigation items) there is a navigation pane with an option to redirect URLs, which I previously avoided because I didn't want users to click to a page only to be redirected back to the page they were on.

Without any other ideas, I decided to create some pages simply to use the URL redirection functionality. I made a sub-page, entered in the relative URL of the parent page and added the anchor link. I tested it, and it turns out that an internet browser is smarter than I am. Since the browser was already on the page with the anchors, it recognized that the link in the sub-nav was already pointing to that page. So, my worry about the browser navigating to this blank page and then re-routing back was unfounded. They all stay on the page and now one can easily jump down to the anchored content. Problem Solved!




Manageability

Every solution has its drawbacks, this one included. If the page content sections were going to change often (meaning anchor tags would come and go) - the resulting pages that are set to redirect would also need to change, which means potential for additional overhead and risks.This is not the case on our site, nor would I imagine it to be the case on most sites, but it is a consideration to keep in mind.

The moral of the story? Keep it simple! If it's easy for you to understand, it's easy for your clients to understand (and we hear that makes them happy).

Chad's Bio Coming Soon!

More About Virgil

Virgil Carroll is the owner and president of High Monkey – based in Minneapolis Minnesota. Virgil also wears the multiple ‘hats’ of Principle Human Solutions Architect and SharePoint Architect.

Virgil is one of those rare individuals who can dive deep into technical topics while speaking clearly to the business owners of a project and never forgetting that the end user experience has the highest priority. He calls it using both sides of his brain. Virgil is passionate about leveraging technologies ‘out of the box’ as much as possible with a focus on the strategic use of content to create websites that deliver the right content to the right audience on the right device at the right time. Virgil brings high energy, an ironic wit, and a sense of grounded perspective whenever he speaks to an audience. Virgil regularly speaks at conferences and user groups throughout the United States and occasionally in Europe.

Posted: 3/20/2013 12:00:00 AM by | with 0 comments
Filed under: