2

I am setting up a new site with Joomla 3.6 (with Gantry 5 and Hydrogen template). There are two template styles, one is default and the other is assigned only to the home page menu item (it has a different layout with more module positions etc.).

Now as long as I browse through the menu items and articles accessible from there (so the URLs are based on the menu structure), it works fine and the default layout is being used.

But if an article is linked like this: /component/content/article/(###-categoryname)/(###-articlename) (such as a featured article which is in a category not directly accessible through the menu) it is always displayed using the home page template style instead of the default one.

I assume I could use some trick with hidden menu, to make the articles in question accessible through menu-structure-based URLs, but in this relatively large and complicated website with many categories I'm not sure I can rely on that.

So do you know what causes this odd behaviour and whether there is any way to change it?

5
  • What type of menu item is your default menu item (cat blog, featured articles, k2, etc)? I ran into this problem awhile back and will search around for the forum post I finally found. Sep 15, 2016 at 18:48
  • Currently it is a Gantry 5 Custom Page – no content, just template layout with modules. But I tried to set is as Featured articles (with the custom layout for home page) and there was the same problem.
    – Matej
    Sep 16, 2016 at 12:43
  • rockettheme.com/forum/gantry5-for-joomla/… The post isn't super concise but what I took out of it is that you can make one hidden menu item that is the same menu type (single article) and it will pull from there rather than having to make menu items for each article. Hope that helps. Sep 16, 2016 at 21:06
  • That's not working for me. I did already have some single article menu items, but the problem was still there.
    – Matej
    Sep 19, 2016 at 14:47
  • But apparently it is an old problem of orphaned articles. It seems the generally suggested solution (or rather workaround) is creating the hidden menu items (discussed in magento60s.com/joomla/… or rockettheme.com/forum/general-discussion/… ). Luckily it seems it is not needed to make menu items for each single article, but just for all top-level categories.
    – Matej
    Sep 19, 2016 at 15:16

1 Answer 1

2

Having articles that are accessible like this: /component/content/article/(###-categoryname)/(###-articlename) Means you haven't created the appropriate menu structure to encompass content in these catgeories.

The reason the wrong template is being used is because Joomla cannot decide what menu item the article belongs to.

It is good practice to create at least container menu items for category views etc so that the Joomla router knows which articles are associated with which menu itemid.

Be careful when creating hidden menu items as you may over complicate the sites structure. Use Aliases when possible to point to existing menu items. Do not put a real menu item as a child to parent that is an alias. You will get:

2016-10-22-12-59-00/stuff

Another good practice is to change Joomla home page from being featured article. Building your home page from a single specific article+modules gives you much more control and frees "Featured" articles to be used elsewhere like a blog or news.

4
  • Thanks for your answer. I understand it is not desirable to have articles accessible only through the component-URL, so it is good to have them linked to a menu item. But what if I want certain articles not accessible through category listing? Then use the hidden menu item? (I'm dealing with an older, large and complicated website with many article categories and components. I'm trying to simplify the structure, but it is not an easy task)
    – Matej
    Dec 5, 2016 at 13:37
  • Also, I'd like to ask why it is a good practice not to have featured articles as home page and what is a better option.
    – Matej
    Dec 5, 2016 at 13:39
  • You can create a menu but not have a module to display it which allows you to create links to articles, that you want to have fixed urls for, but they will sit outside the hierearchical structure of the main menu A new feature on latest Joomla allows you to create menu items in the structure you want(i.e. your main menu) but not show menu item on the menu. (Doesn't work will all templates).
    – BodgeIT
    Dec 5, 2016 at 18:33
  • You are using Gantry 5, a great template framework, "Do not display on menu" feature works OK. Your Use of Custom Page is good alternative for Home page build.
    – BodgeIT
    Dec 5, 2016 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.