One of the most? frequently asked questions on the Joomla forums is “What is the Itemid and what does it do?”. Its something that frustrates even experienced developers … witness the post called “Damn you, infernal item IDs!!!” on WhyJoomla.com.
I thought a quick tutorial would be useful and along the way we can break down other aspects of Joomla URLs.
An Example Joomla URL and Itemid
Let’s use a news item called “Joomla Weekly News Magazine Issue 10” written by Brian Teeman.
If you navigate to this news item via Joomla.org, you can see this URL in the browser bar:
http://www.joomla.org/content/view/2985/33/
You see this because inside the administrator section of Joomla.org, Search Engine Friendly URLs have been turned on (Site => Global Configuration => SEO => Search Engine Friendly URLs = Yes). Its a shorter version of the real URL produced by Joomla:
http://joomla.org/index.php?option=com_content&task=view&id=2985&Itemid=33
Breaking Down those Two URLs
Default URL | Default SEF URL | Other Examples | |
Component Name | option=com_content | content | option=com_wrapper produces a page using the wrapper component |
This explains what the component is being asked to do. | task=view | view |
task=emailform allows you to send the page via email do_pdf creates a PDF copy of the page |
Number to identify the content item | id=2985 | 2985 | Joomla starts at 1 and works up, so there have nearly been 3000 articles published on Joomla.org |
Number to identify the menu link leading to the content item | Itemid=33 | 33 | Joomla starts at 1 and works up. “What is Joomla?” is menu link number 26. “Submit Your News” is number 75. |
What’s the point of the Joomla Itemid?
The Itemid is what Joomla uses to decide which modules and templates need to appear on the page:
For example, the Itemid for Brian’s article is 33. What happens if we change that to 26 for example?
http://www.joomla.org/content/view/2985/26/
- The purple “News” template changes to the red “Main” template.
- The “News” modules disappear and the “Main” modules appear instead.
We can do the reverse and make “What is Joomla?” appear to be a news item:
http://www.joomla.org/content/view/12/33/
When you open up the Template Manager and assign templates to a particular page or open up a Module and assign it to a page, it is the Itemid that does the work.
There is a limit to how much of this messing around you can do this on Joomla.org because the site is really 6 separate sites. Each site has its own Itemid structure. We can use the same URL as above to take us to a different page on each site:
- http://help.joomla.org/content/view/12/33/
- http://extensions.joomla.org/content/view/12/33/
- http://dev.joomla.org/content/view/12/33/
This is one reason why we recommend that people use Open SEF, Artio SEF or SEF Advance … lots of Joomla sites have identical URLs. A quick search on Google produces 450 pages with the same URL /content/view/12/33. If you want to stand out and help Google understand the content on your page, it helps to have a Search Engine Friendly URL Component installed.
The Future of the Itemid in Joomla
The Itemid setup is undergoing a substantial revision in Joomla 1.5. You can find out more in this post by Johan Janssens, Joomla’s lead developer.