Keeping your Joomla code tidy

clean joomla codeThere is more to running a Joomla site then picking out a template, installing a few plugins and releasing it to the world. Is your code neat and legible? Is your site prepped for SEO? Are you loading javascript libraries more than once? In your site executing unnecessary code? Chances are high that there is plenty of fat to be trimmed from your site. Let’s look at some of the bigger issues you might have.

remove meta generator

Too much meta info

Open up your website, right click, and view your source code. Look for the “meta name” lines.

meta name="keywords" content="keyword, another keyword, more keywords"

meta name="description" content="This is your meta description field. It will be made up of 156 or less characters and will be what you see in Google search results so make it perfect."

These are the most important meta tags you can have on your site. They must be different for every page on your site, they must not include your site name, and they need to be skillfully written to include keywords representing what your single webpage is about. If you use the same meta description for every single page, Google might not rank you properly or can potentially penalize you. Proper SEO is a whole other topic we will talk about in the future. If you want some quick tips and solutions for SEO in your Joomla site, try out our SEO extension. Now, let’s get back to meta tags.
Joomla loves adding additional meta information. Every single Joomla install you do will have this tag automatically added to your site.

meta name="generator" content="Joomla! 1.5 - Open Source Content Management"

This is a largely useless tag, used mostly to advertise Joomla. You can remove it by using a plugin or by adding a small bit of code to your site. You can read about how do do that in this blog post.
There are about a million different meta tags you can use in a website. Make sure to use only the ones you absolutely need, and if you aren’t using one, take it out. Do you want an easy way to edit all your Joomla meta tags at once? Try our extension.

Keeping your < head > clear

The < head > element of your source code is the place where a lot of stuff is going on. You will see meta information, references to css, stylesheets, javascript files, Google tracking code and a variety of other things beyond the scope of this article. This area can quickly get bloated and out of control. If your < head > area has 500 lines of code inside of it, you are doing something wrong. Webpages will load slower, Google will have more troubles scanning and indexing your site, and compliance will most likely be shot as well. Try to keep things tidy, and having a solid understanding of what is in the < head > area of your website is infinitely valuable.

Too much bling

When building a website it is easy to get caught up in fancy sliders and widgets and tabs and lightboxes and flippy things. They look pretty, and in many cases help display content on your site. The down side is code bloat. Look at this example:

What is wrong here?

Lines 1,2,3,4,5 and 6 are all calling some sort of javascript. The problem is 1,2,& 3 are calling the same code but in different locations. This means every single time you load your website, you are executing 3 identical chunks of code. This will make a massive impact on your page load speed, as well as potentially conflict with your website, preventing your fancy effects from even working.

What else is wrong?

You can also see in this example that jquery is being loaded two times at once. Frequently jQuery and MooTools will conflict with each other causing all sorts of headaches. When possible, try to stick with one form of javascript or the other. Running both on your site is code bloat. When looking for extensions, try to make sure you always use the same library. It will be better for you in the long run.

Do you have any tips or pet peeves?

These are some of my pet peeves for a clean Joomla site. What do you do to keep your site clean, fast and efficient?

Tags: , , , ,



Merav Knafo is the founder and CEO of iJoomla, Inc. She loves writing about Joomla, usability and Social Networking.

Leave a comment

  • Avatar




    Our company is slowely evaluating to move from RoboHelp to Joomla. There are several teething issues, one main thing is we are not able to copy the content from RoboHelp to Joomla. It would be great if you can throw us some light on formating text and creating tables with designs etc.