Joomla Hidden Menus

There are several reasons why using a content management system is better than a static website. You don't need any local software, so updates can be made from any Internet connected computer or mobile device. Multiple people can make changes. And if a change needs to be made to multiple pages, this is usually easier and faster with a CMS. There are downsides too and in this article, you'll discover the challenge of implementing a hidden page on a Joomla website.

What's a hidden page?

There are occasions when you need to create a page to tie in with some sort of functionality. For example, you might have a feedback form that when submitted, redirects to a "thank you" page. Or perhaps you have some sort of third-party payment system that redirects the customer back to a particular page on your site after a successful transaction. These confirmation pages should only appear as part of the related process, so you don't want a link to them in a menu. Obtaining the appropriate link might seem easy, but getting the page to look the way you want it to isn't so obvious. Let's go through the entire process.

1. Create a new category - You don't want confirmation pages mixed in with your regular articles. So create a specific category and in this case I will call it hidden.

2. Create the confirmation article as you would any other article and store it in the category you created in the first step.

3. Create a new Menu by going to Menus - Menu Manager - Add New Menu. Give it a title and a name. There is no need to create an associated menu module because you don't want the the links in this menu to appear on the website.

4. Create a new menu item in the new menu. You'll most likely want to use the Single Article option. And then select the article that was created in step 2. Now there are two pieces of information to collect from this page. The first is the Link field which shows:
index.php?option=com_content&view=article
That's the first part of the URL that will point to this article. Save this article and then note that this changes and its too long to read. Click the cursor within this box and select everything. This can be a bit tricky with the mouse so use CTRL+A on Windows or Command+A on a Mac. Then copy. That's CTRL+C or Command+C. Now I'll come back to this, but while we're here, also make a note of the number next to ID which might be something like 538.

b2ap3_thumbnail_25-07-2012_hidden-page-2_20120725-044616_1.png

5. Go to the frontend home page and paste the URL after the domain name. It should look something like:

www.yourdomainname.com/index.php?option=com_content&view=article&id=13

This is the confirmation page and at first glance it looks okay. But note that the word Articles appears at the top. And how do you control which modules appear on this page? These challenges occur because Joomla doesn't recognise this page. Pages are created by menu items and although we specified the article ID number, Joomla also needs to know about the menu. And that's where the second piece of information is needed.

6. Add the menu ID number to the end of the URL. If you didn't note this in step 4, go back to the appropriate menu page and look for it in the last column labelled ID. Then add this to the end of the URL:

&Itemid=XXX

where XXX is the ID code.

For example the full url might become:

index.php?option=com_content&view=article&id=13&Itemid=538

where id=13 is the article ID number and Itemid=538 is the menu ID number. Note that the first I in Itemid must be a capital I.

Now the word Articles has disappeared and you can manipulate modules on this page as you please. Let's remove the Users Latest module. Go to Module Manager, find the module and choose the option to display the module on all pages except the one specified. And check the hidden page so the module doesn't display on this page. Refresh the frontend to see that the module has been removed. You might be tempted to just try this last step without bothering to add the menuid, but it doesn't work. If I load the page with the menu id in the URL, the module returns. Once again, this is because we haven't told Joomla about our desired menu, so it doesn't know which modules to display.

One last thing to mention. These are of course Joomla's native URL's as opposed to search engine friendly URL's. That's not an issue because you don't want these pages indexed by search engines anyway. They're purely to be used to paste into the relevant field within whatever extension or off-site application you're using. In fact, it's a good idea to hide these pages from search engines by going back to the menu item and look at Metadata - Robots and change the setting to one of the Noindex options. In theory robots shouldn't find these pages because they don't exist in a menu. But if you are using a sitemap extension, the URL might get added without your knowledge. If a search engine happens to find the page, it will not index it if you enable this setting.