Someone recently asked me how to sort links (content) based on site visitor preferences, specifically in the context of generating links for navigation. For example, each visitor accessing a sporting goods site may see their preferred sport(s) as the first link(s) in the main navigation. This blog post provides a short conceptual response.
My first response was that I would not do this. The visitor experience would be inconsistent, not just for different visitors accessing the same site, but for a single visitor using different browsers or devices to access that site.
The only factor that I can think of that would override this concern is that the visitors are users, which means that they must authenticate to access the site. Note that these users are not CMS users, which authenticate against the CMS to manage content (and which I may sometimes refer to as simply users, sorry). If preference sorting logic applies for visitors that authenticate, then the solution can apply preferences consistently on different browsers and devices.
If preferences are stored in user profiles, then you may be able to use tagging to sort data. For the sports example, tag each content entry that represents a sport category with an identifier that maps to the value in the user’s profile that indicates their preferred sport. When generating the links, iterate those preferences and render links to the category entries that contain that/those tag(s) before excluding those categories while iterating the remaining category entries in their default sort order or according to additional sorting logic.
This is a relatively simple example, but the general concept could apply to any case of sorting data by preference. If you have additional suggestions, example requirements, or other information or resources about this topic, please comment on this blog post.