I have a content type let's say content type 'A', I am using view to show some of the field on some page, Now the problem is that pages generated by the content type are just a junk because I am not showing it to uses , only i am showing it using view page/block. Problem: I don't want to show those junk page in Search result , Plz let me know how to do it?
-
possible duplicate of Remove a content type from search results– roobyCommented Oct 25, 2014 at 4:31
-
Also you may want the rabbit_hole module to stop users viewing the actual node page at the node/NID URL.– roobyCommented Oct 25, 2014 at 4:32
-
@rooby I prefer global redirect for that, works more... globally ;)– MołotCommented Oct 30, 2014 at 8:29
-
@molot: Sorry I didn't specifically mean the node/NID URL but the node page in general, because the OP says they don't want to show node pages to users because they exclusively use views for that (if I understood correctly).– roobyCommented Oct 30, 2014 at 23:07
2 Answers
You can achieve required customization by using Search configuration module.
additional things can be done with the modules are:
- Alter the appearance of the core node search form.
- Group content types for more meaningful searching
- Restrict search results by the content type. This is a role based restriction.
- Restrict search results from showing individual items.
- Alter the pager limit (aka number search item results per page).
If you are still using the search from core, you should switch to for example search_api.
That beeing sayed, if you wish to avoid installing another contrib module and are willing to implement the functionality as a part of custom module. You could set excluded node types (programmatically) and then use hook_query_alter to filter out those types from each search.
-
This is not necessary but is an option. You don't have to write code to do what the OP asks.– roobyCommented Oct 25, 2014 at 4:26
-
Added note that this answer suggestion is for the cases where keeping contrib module count low is preferred. It would be nice to have answer type taxonomy here, so "theres a module for that" and "diy" answers could be separated or even accepted as alternative. Commented Oct 27, 2014 at 7:57