2

I'm building a website, where I don't want to display nodes directly. All nodes are presented using Views. The idea is that i've got 10 basic pages without content. On each of these page I've got one or more Views as blocks. In these Views i show my nodes.

THE PROBLEM: When I use drupal search I get results with direct links to nodes. Instead I would like get links to pages where the View is located, containing that node. I can easily achieve that by changing alias to page with that View. For example: I've changed alias content/function-one to /functions (page with View which presents functions) and it works, but there are another problems there.

  • First, I can still access nodes directly by url /node/%nid.

  • Second, I can have links only to pages with Views, but I still want to navigate to the nodes. I thought I can achieve it using anchors. I modified my alias to /functions#functionOne. But my href looks like /functions%23;functionOne and the anchor doesn't work.

So my goal is to disable access to nodes by /node/%nid and make my search results to give me link to the page that contains View with that node and navigate user to that node.

Any ideas how I can achieve that? Alternative approaches?

Thanks in advance

2 Answers 2

1

Take a look at Rabbit Hole ( https://www.drupal.org/project/rabbit_hole ) , it has several options as to what has to happen when a Node is viewed ( or trying to get viewed ) directly.

0

I'm thinking about setting nodes to display other nodes in a view or multiple views as EVA. Simple nodes (content nodes) should point to nodes considered categories (blanc nodes, taking just the view) (list of nodes in those views) using entity reference. Attach EVA blocks to your category nodes as field and customize your search. Could work with Display Suite very nice, using DS search option.

3
  • Thanks for idea, so I need new content type "better basic page" with entity reference, display entities as rendered entities without wrappers and separator. Sounds good. Probably I'm to far because I made 90% of my site using views, because it was easy to me to theme elements and I was learning. Now with my 2 weeks experience I can say that your approach could be better, I have to consider to "rewrite" my site. But still i don't know how to navigate user to specified node, i can't do it with anhor...
    – szapio
    Apr 9, 2015 at 12:59
  • If your search result will display certain fields from your view, a linked node or a collection of linked nodes could show up in that particular customized search. You could also try to render a views page for search. A view block is even easier. So user searches for better basic page by title and as a result gets the better page title, accompanied by the list of nodes referencing to that page. It shouldnt be too difficult to achieve, although takes a little bit of time. You could also rearrange node weights within your list and select the first 10, lets say. Good luck!
    – designarti
    Apr 9, 2015 at 13:05
  • Thanks, but still got trouble. I've got one long page with 6 nodes. With search module I can find page where is node that I'm looking for. This nodes are quite big and the one what I'm looking for is at very bottom of page. User needs to scroll down. Probably I'll make it with javascript and additional parameter in url.
    – szapio
    Apr 10, 2015 at 6:32

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.