K2 4.2.1 Alias bug [fixed]
If you use the latest version of K2 (as of this writting) with SH404, one thing that you will notice is that the category and item alias is completely disregarded when building the SEF url. No matter what, K2 will use a URL safe version of the Title instead of the alias. If you rely on Aliases to craft your URLs then upgrading to K2 can lead to completely broken links.
This is a recurring question on the K2 forum and one that I ran into when I started using K2. After some back and forth with the Joomlaworks folks, a fix was made to:
and checked into the K2 SVN (trunk 521). So if you want to use aliases, make sure you download that file (just grab the latest SVN here – bottom right link – and grab this file from it).
Limited URL crafting options
SH404 is full of options that allow you to finely craft the URL of a Joomla article but most of these don’t work with K2 items and categories. As of version 4.2.1, the only three options you have (located at the bottom of the K2 parameters) are:
sh404SEF URL prefix for categories
Honestly, I really haven’t really found a use case for this one. This option adds a single prefix in front of every category URL but not item URLs… Let’s say you add the word “Prefix” in this field, your URLs will end up as http://joomquery.com/prefix/category-name or http://joomquery.com/prefix/category-parent/category-child BUT the individual items under these categories will follow the URL category prefix option described below and completely disregard this field.
sh404SEF URL prefix for users/authors
This is what you want to see in the SEF path before the author’s name when you click on their name. K2 defaults this to ‘blog’, but I tend to change it to ‘authors’ because I find it a lot more logical (you probably already have a top level category named ‘Blog’).
sh404SEF URL category prefix for items
- “No categories” – the URL will only have the domain name followed by the item name like http://joomquery.com/item-name
- “Only the last category” will show a URL like http://joomquery.com/category/item-name
- “All categories” – this will be visible if you have multiple nested categories – will show URLs like http://joomquery.com/category-parent/category-child/item-name
Page IDs (ie: short links)
Unfortunately, Page IDs will not work with K2 content until K2 adds support for it. For the moment, you will have to manually add an alias to each page you want to create a short link for (although a pretty good idea to do if your domain name is short)
April 18 2011 UPDATE: Good news everyone! sh404sef recently changed the Page ID functionality. It is now called shURL and now support K2 content (make sure to enable shURL AND turn it on for K2 content. I’ll have a separate post about it shortly. The build I have tested it with is build 184.108.40.2065 and it works great!