A camera screenshot of the new SEF URL settings in K2 v2.6.4
Although not even 10 days have passed since we released K2 v2.6.3, we decided it would be a shame not to release this new version 2.6.4 ASAP. You see, this new release brings some SEF URL enhancements which we know many K2 users will love. To quickly sum things up we have added the new K2 advanced SEF options, tag normalization options, jQuery 1.8.3 and 1.9.1, improved the transliteration logic introduced in v2.6.3 and removed 2 obsolete online image editors (used via the backend).
If you are on Joomla! 1.5, grab the zip file from the link above and install it on top of your existing K2 version. If you are on Joomla! 2.5 or 3.0, go to the Joomla! update manager, purge the update cache, re-check and you'll see the new release available to instantly update. If you are on Joomla! 1.6 or 1.7 then someone probably cut off your internet connection a year ago: upgrade to 2.5 now!
So what's changed or been updated in this new release in more detail?
The big improvement is obviously the addition of the "Advanced SEF Settings" section in the K2 parameters. The "discussion" to offer such options built-into K2 was essentially opened by Roberto Segura and Matt Thomas on Twitter. Roberto had worked on an improved URL router over a year ago and he decided to update his code for K2 v2.6.3. We then took his code and added Joomla! 1.5 compatibility plus 4 more options to add "URL flexibility" we've been asked for and seen in the past (Greece's no. 1 website in traffic www.newsbomb.gr is a good example - yeap, built with Joomla! and K2).
The new options, combined with 2 more options already present in K2 since v2.6.1 (in the "Layout & Views" tab in K2 parameters) allow you to do the following:
a) kill duplicate URLs created for tags and users once and for all. You have to understand that duplicate URLs are un-avoidable the way Joomla! URLs are constructed "by default". So to fix that, we use a simple trick. Create a new menu that you don't use on any menu module. Let's call it "Hidden". In that menu, create a new menu item pointing to all K2 categories. Set the limits for leading, primary etc. all to zero and disable pagination & rss. Give this menu item a nice menu alias, e.g. "show". You can name the actual menu item whatever you want, what matters is its "alias". Now head over to the K2 parameters and in the "Content" tab look for "Default parent menu for user pages (optional)" and for "Default parent menu for tag listings (optional)" and assign both to this new menu item you created with alias "show". Save the K2 parameters, clear your site's cache and navigate to the frontend of your site. Now all tags and all links to users (authors) have the same prefix no matter on what page you are. You can browse this site as an example.
b) you can now "format" K2 URLs to look better. Instead of having "category", "user" or "tag" in your URLs, you can replace that with whatever word you want. In combination with point (a), a URL like http://domain.com/blog/itemlist/user/2-johndoe can now be shown as http://domain.com/show/author/2-johndoe - much better! Additionally, we have included tweaks to the K2 item URLs as well, so a URL like http://domain.com/somecategory/item/168-some-title can now become http://domain.com/somecategory/story/168/some-title or even http://domain.com/story/168/some-title or even http://domain.com/story/some-title or even http://domain.com/some-title - the combinations are endless. If you choose to use a forward slash instead of a dash in the last part of the K2 item URL, you get bonus points from Google News as well (per their guidelines for content crawling).
There is a small caveat however. But only when you decide to kill the item ID from the URL. K2 will have to execute an additional database query for EVERY K2 link rendered on any page with K2 content on your site. Additionally, if 2 or more K2 items share the same "title alias" and exist on the same category, when you see these 2 or more items on the same page and click any of them, you'll always be redirected to the first item that is matched in the database (cause the matching is done by "title alias" and not ID anymore). For small sites this is not a big deal and the performance hit is next to nothing. But on sites with more than a few dozen items this can get tricky. For sites with thousands of items the performance hit is simply not worth it. So if you can live with the item ID being present on the K2 item URLs, you can now have better looking and search engine friendlier URLs on your Joomla!/K2 site. Just remember that these URL improvements only apply to K2 content only.
Among other minor fixes, we have improved the transliteration logic introduced in K2 v2.6.3 and we have updated the built-in set of SEF character replacements (now supporting transliteration for accented Latin, Greek and Cyrillic characters to their latin non-accented equivalents). To see these new set of character replacement pairs, simply delete the entries in the "SEF URL character replacements" option, in the "Advanced" tab of the K2 parameters. These replacements will come handy especially on Joomla! 1.5 (if you don't want unicode URLs as output by K2 by default) and in Joomla! 2.5+ if you simply want to force your own replacements (there's a switch for that).
Seeing how people "tag" content over the years, we also decided to add a new "tag normalization" option in K2 v2.6.4. This option aims to limit the presence of multiple references to the same actual tag, because different letter casing is used in these references. If you enable this filter (under the "Advanced" tab in K2 parameters), then tags can be normalized to lowercase or uppercase, non-accented characters. So the tags "hello", "Hello" and "HEllo" would all be saved as "hello" in K2's database. Similarly, the Greek accented (or not) tags "Τεχνολογία", "ΤΕΧΝΟΛΟΓΙΑ" and "Τεχνολογια" will all be saved as "τεχνολογια" in K2's database. These filters work for accented Latin, Greek and Cyrillic for now. And you can always add your own pairs (see the tooltip explanation under each option).
A cryptic changelog summary follows:
- New advanced SEF options (based on https://gist.github.com/4687829)
- mod_k2_content: allow html in pretext
- Fixed transliteration logic when no other language but English is present on a site
- Removed Google Picnik & Aviary online image editors (they are now offline)
- Added jQuery 1.8.3 and 1.9.1
- New tag normalization options
- New message "no results found" for search/tag listings. Added 2 lines of CSS on k2.css and a small addition to the generic.php override - you don't need to update though your overrides, as the change is style related only.
- Updated class.upload.php to v.0.32
- Tags of 1 character are not allowed to be inserted anymore into K2
- Gravatar avatars can now be loaded from both secure and insecure paths (automated, based on your page's state).
- K2 extra fields: alias creation improved, added transliteration for accented latin, greek and cyrillic characters.
- Counter set in "items being moved" windows in the backend (when initiating a "move" operation).
- K2 plugin events are now rendered on all K2 views
- Joomla! 2.5+ permissions check for the 2 backend modules. If a user has no rights on K2, they won't see this module.
UPDATE: The new K2 advanced SEF router is not working with searches initiated from the K2 Tools module (in "search" mode). If you use Joomla!'s search module, you can safely use the new SEF settings. If you don't, just don't enable them. An update is coming...
JoomlaWorks is developing and supporting some of the most respected and popular extensions in the Joomla! community, including the groundbreaking K2, AllVideos, Simple Image Gallery and Frontpage Slideshow.
Since 2006 we have developed more than 26 extensions for the Joomla! CMS, all of which have been used in hundreds of thousands of Joomla! sites across the world.
Mid 2011, our extensions had been downloaded more that 4.5 million times, out of which AllVideos and Simple Image Gallery had more than 1.5 million downloads each and K2 more than 500,000!
Innovation and the open source philosophy are the two things that motivate us!