0

I'm new to joomla development. I use joomla v3.6.2, and in home page, I have some article. Unfortunately when I click on article title or read more link, it will show me the full article but still in home page. I read some solution, and what I try to do now is using hidden menu technique. It works like what I want, but my problem now is how can I override the href of title and read more, so I can assign to the url to hidden menu. I read some code in readmore.php in layout folder and it seems that I have to change value in this line:

<p class="readmore">
<a class="btn" href="<?php echo $displayData['link']; ?>" itemprop="url">

can anyone help me how to achieve this?

1
  • If you have assigned menu items to your articles and categories, then you should not have to make any template adjustments at all. If you still have problems, please add more details about your menu and article setup. Sep 23, 2016 at 17:16

2 Answers 2

1

Articles will inherit the alias of the menu items in the following order of menu items.

  1. Single Article menu item (choose article in this menu)
  2. Category Blog/List menu item (of category the article is in)
  3. Home page menu item

So if your url of the article is in following format without menu item:

mywebsite.com/components/index.php/component/content/article/4-about-your-home-page

Your url will become like this if you create:

Single Article menu item with alias as "my-article"
mywebsite.com/index.php/my-article

Category menu item with the alias as "my-category"
mywebsite.com/index.php/my-category/4-about-your-home-page

So create the right menu item with right alias. Always avoid modifying Joomla! core files.

Note: index.php is intentionally striked down, it will go away if you enable url rewriting in global configuration (of course using mod_rewrite or any other)

0

Approaching the problem from another side, you can use Advanced Module Manager from NoNumbers to set all the modules from your homepage to only show on homepage and not on non-menu item pages: https://www.regularlabs.com/extensions/advancedmodulemanager

2
  • it makes life more complex, imho. no offence.
    – Nagarjun
    Aug 9, 2016 at 20:19
  • I disagree. You might set 5 module's assignments from the Home page menu item to the Homepage option in Advanced Module Manager. Then every future non menu item will look correct and not look like it is appearing on the homepage. Other options will have you making hidden menu items or a template override. Aug 9, 2016 at 20:21

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.