Wednesday, August 13, 2014

The Web Refinements Continue ...

As my journey continues I felt it was time to continue this series of articles with its second installment.

One of the main areas of difficulty for many is to understand how Joomla! generates URLs and how to modify the various settings to achieve what you want for URL's on your site.  This article will concentrate on Joomla 3 but most of it will also apply to earlier versions.

First lets set some basic understandings:

1. Articles have their own URL (e.g., article title linkable set to 'yes').
2. Menu items that link to articles have their own URL, which also points to the article. (So I never have enabled menu items directly to an article.)

So you have two different ways to get to the same content and two different URLs as well.  This duplicate URL situation is not the best approach especially when you consider the SEO ramifications of multiple URLs.   Here are some suggestions on how to manage your site's URLs.  I use categories as active menu targets and then with 'clickable' titles the user can go to any article from within the category listings.  This helps eliminate a big source of duplicate URLs on your Joomla site.  There is one exception to this rule - a 'Hidden Menu'.  A hidden Menu is a menu that has no associated module so it is never displayed on your site.

Start by creating a new menu but do not assign it a module so it is never an active menu in the sense that it is never displayed and no user can select a menu item.  You can name it whatever you want but I typically name it - 'Hidden Menu'.  Because it doesn't have a module assigned this menu will never be displayed on your site but it will be used by Joomla in the generation of URLs.   This menu name is very self-descriptive of the purpose of this menu.

Next create a menu item for every article on your site or at least every article that you want to access directly (articles where the title is linkable).  When creating these menu entries pay special attention to the menu item Alias.  Joomla will use the Alias as the page URL for the specific article assuming that Search Friendly URLs is set to Yes on the Global Configuration page.   This should become a normal part of article creation and will remove the need to create the menu items in mass at some future date.

With these changes in place instead of getting a page URL of 'http://www.domain.com/articles/politics/6-politics/4-myarticle.html' you can get a page URL like 'http://www.domain.com/myarticle' when the article is displayed directly from within the category listing by setting the hidden menu item Alias to 'myarticle'.  Remember Alias's must be globally unique throughout you entire site so this can take some forethought on larger sites.  Then with the resultant page title set to 'SiteName - My Article' you have a very nice and consistent presentation of URLs.

Next is the page title that displays in the tab for the page.  In most cases you will want to modify this by setting the page title in the menu item - Page Display screen - to be what you want to be displayed as the page title.  You are limited to 65 characters which should be more than enough but remember if you are allowing the inclusion of your site name ( 'Include Site Name in Page Titles' ) this will also be counted as characters.

Although you can have the site name included automatically in your page titles, I have found that setting page titles manually gives very finite control of what is actually displayed and eliminates any confusion for future development.

For items on displayable menu's Joomla will use the menu item title as the URL and you can set the browser page title to what you want to be displayed when a specific menu item is selected. So there you have it - Articles and Menu's - two ways to display content and how to control the URLs and the page titles.

Be sure to go to the Global Configuration page and set 'Include Site Name in Page Titles' to 'No' or your site name will also be included in the page titles.  Also you should turn on SEF URLs by setting 'Search Friendly URLs' to 'Yes'.   If your site is hosted on an Apache web server you need to rename the 'htaccess.txt' file to '.htaccess' and then turn on 'Use URL Rewriting' by setting it to 'Yes'.  If you have difficulty with this contact your hosting provider and they can assist you in getting this file renamed and Apache Rewriting working properly.  With these changes you should be in good shape and in control of your site's URLs.  If your site host balks at setting up URL Rewriting - move as fast as you can to another host.

There's more to discuss but I will leave that till next time.

Please contact me directly if you have any questions.