Smart Search Links Going to Home Page - hack? Topic is solved

General questions relating to Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Fri Mar 01, 2024 11:04 pm

Okay, we have the same issue as everyone - Smart Search brings up articles that aren't in a menu item anywhere and when you click on them it loads them on the home page with whatever other modules, etc., are displayed there.

Bad Smart Search. BAD!

So here's our hack, sort of. We created a hidden Category List menu item called Search Results and included every article category on the site.

Now when you use Smart Search and click on a link that isn't in any other menu item, it displays on the menu item which can show whatever other modules you want on it. Only issue is, articles in a menu item will show twice in the search. Much better than throwing them on the homepage.

IDEA - could Smart Search be modified so it has a default menu item if the article isn't in a menu anywhere else? Way over my pay grade here, but seems reasonable.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Fri Mar 01, 2024 11:49 pm

You are not being directed to the Home page. You are being directed to the Article page. If you have modules set 'All except selected' then they appear on every page that has no menu item.

If you have a Category blog menu Articles without menu items (in that Category) then show the modules associated with the Category blog menu item.
https://docs.joomla.org/How_do_you_assi ... c_pages%3F
https://docs.joomla.org/How_to_control_ ... _menu_item
https://extensions.joomla.org/extension ... e-manager/
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sat Mar 02, 2024 6:18 am

Not sure I'm following you.

The modules we have on the home page are set to "Only on the pages selected" which in this case is the home page. When we do a search and the article in the list is not on any menu item, it defaults to showing it on the homepage which shows all our home page modules.

Hope I'm being clear here.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 7:37 am

It is not defaulting to the home page
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12781
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Smart Search Links Going to Home Page - hack?

Post by brian » Sat Mar 02, 2024 7:58 am

Sorry @webdongle you are wrong. If there is no menu item for something then the default menu item is used which is the home page.

@umbrellax What you are describing as a "hack" is exactly what you should do. In fact its what is done as an example in the sampledata
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sat Mar 02, 2024 8:29 am

The oddity is that when we do this, it lists the articles twice if the *are* in another menu - not exactly what we would think is best practice.

Or am I missing something?

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30875
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Smart Search Links Going to Home Page - hack?

Post by Per Yngve Berg » Sat Mar 02, 2024 8:41 am

Do you have a Menu Item of type Smart Search?

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sat Mar 02, 2024 9:11 am

Yes, our searches are done through a Smart Search menu item.

Why do you ask?

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 10:09 am

brian wrote:
Sat Mar 02, 2024 7:58 am
Sorry @webdongle you are wrong. If there is no menu item for something then the default menu item is used which is the home page.

...
No it is not the home page it is the Articles page with the same modules displaying. Or are you saying that the url of the page is the same as the home page?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sat Mar 02, 2024 10:14 am

We believe it is the homepage because we have a class on the home menu item that is showing when we click on a search item that is not in a menu item.

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12781
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Smart Search Links Going to Home Page - hack?

Post by brian » Sat Mar 02, 2024 10:18 am

When there is no menu item for an article then the menu used is the default aka the home menu. Remember menu = itemid. Therefore any modules set for the home page will be displayed. just turn off sef urls and you will see the itemid being used or look at the body class.
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 2:58 pm

brian wrote:
Sat Mar 02, 2024 10:18 am
When there is no menu item for an article then the menu used is the default aka the home menu...
Yes but that does not make it the home page. Different url (different item id) = different page even if it displays the same modules

In any case (despite your different definition of home page) the links
https://docs.joomla.org/How_do_you_assi ... c_pages%3F
https://docs.joomla.org/How_to_control_ ... _menu_item
https://extensions.joomla.org/extension ... e-manager/
Are valid
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sat Mar 02, 2024 5:24 pm

Valid, perhaps, but not optimal for users.

We definitely do not want all the homepage modules showing on search item links just because the article itself is not linked through a menu item. We set those modules to show *only* on the home page.

Thus our “hack”.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 6:34 pm

Create hidden menu items for categories is one solution. Advanced module manager is found useful for many users.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12781
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Smart Search Links Going to Home Page - hack?

Post by brian » Sat Mar 02, 2024 7:08 pm

Yes but that does not make it the home page. Different url (different item id) = different page even if it displays the same modules
Its the same itemid thats the entire reason its showing the home page modules.
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 8:14 pm

I just performed a test on my site
  • Disabled Search Engine Friendly URLs
  • Set login module to Home (default menu item) only
  • In an Article that has no menu item wrote qwerty
  • Re-index smart search
  • Created menu item for smart search
  • Went to front end
  • Searched qwerty
  • Clicked the result
  • Result no login module was displayed url index.php?option=com_content&view=article&id=65:no-menu-item-alias&catid=9&highlight=WyJxd2VydHkiXQ==&Itemid=203
  • Clicked the Home (default menu item) login module was displayed
  • url showed /index.php?option=com_content&view=featured&Itemid=101
The Article with no menu item was not associated with anything on the Home (default menu item)

So clicking the result of the search does not redirect to the Home (default menu item)
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
brian
Joomla! Master
Joomla! Master
Posts: 12781
Joined: Fri Aug 12, 2005 7:19 am
Location: Leeds, UK
Contact:

Re: Smart Search Links Going to Home Page - hack?

Post by brian » Sat Mar 02, 2024 8:36 pm

Itemid=101 is the home menu item id
"Exploited yesterday... Hacked tomorrow"
Blog http://brian.teeman.net/
Joomla Hidden Secrets http://hiddenjoomlasecrets.com/

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sat Mar 02, 2024 10:00 pm

brian wrote:
Sat Mar 02, 2024 8:36 pm
Itemid=101 is the home menu item id
Duh ... but the result from the search led to a page with id 203 not 101. Try reading what is posted
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Sun Mar 03, 2024 8:38 am

We don't wish to use non-seo friendly links of course.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 44063
Joined: Sat Apr 05, 2008 9:58 pm

Re: Smart Search Links Going to Home Page - hack?

Post by Webdongle » Sun Mar 03, 2024 11:31 am

umbrellax2 wrote:
Sun Mar 03, 2024 8:38 am
We don't wish to use non-seo friendly links of course.
I only used those as an example to prove they are different pages
brian wrote:
Sat Mar 02, 2024 10:18 am
... just turn off sef urls and you will see the itemid being used .....
Are the Articles in the results connected to menu items?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

umbrellax2
Joomla! Intern
Joomla! Intern
Posts: 64
Joined: Fri Apr 30, 2010 2:14 pm

Re: Smart Search Links Going to Home Page - hack?

Post by umbrellax2 » Thu Apr 04, 2024 7:52 pm

Sadly, still having to use this "hack".

Does anyone have a better idea on how to get Smart Search to stop showing search results on the homepage if the content isn't linked in a menu item?


Post Reply

Return to “General Questions/New to Joomla! 4.x”