5

I would like to disable the taxonomy/term/1 page that list the nodes using that taxonomy term. I have found some modules for older Drupal versions, but I haven't found quite what I'm looking for in Drupal 8.

Is there a configuration setting I am missing? Can I use a hook to disable the taxonomy term page, or does this require a module?

  • only for one term or for all the vocabulary? – Adrian Cid Almaguer Aug 29 '17 at 16:28
  • All terms in a vocabulary - and all terms period. We don't want to enable exploring the site via Taxonomy Term pages. – thaddeusmt Aug 29 '17 at 19:06
  • in this case check my answer and you will find your solution. – Adrian Cid Almaguer Aug 29 '17 at 19:10
1

The Rabbit Hole module can help you in this task

Rabbit Hole is a module that adds the ability to control what should happen when an entity is being viewed at its own page.

You need to enable the Rabbit Hole and Rabbit Hole taxonomy submodule and then in the admin/structure/taxonomy/manage/YOUR_VOCABULARY page you will see the Rabbit Hole Options.

|improve this answer|||||
  • it doesn't help in this issue! I just want to prevent drupal from listing nodes in taxonomy page. – shekoufeh May 22 '19 at 14:36
  • @shekoufeh your problem is different from the problem asked in the question. – Adrian Cid Almaguer May 22 '19 at 15:22
13

A lightweight solution is to simply edit the taxonomy term view : /admin/structure/views/view/taxonomy_term

... and restrict the access.

|improve this answer|||||
  • it is the best solution. you saved me a lot of time and energy. thanks. – shekoufeh May 22 '19 at 14:38
  • Simple and easy without needing to install anything. This should be the selected answer!!! – Sam Nov 21 '19 at 16:07
  • Why not disabling this view all together? – gagarine Jan 15 at 17:53
0
  1. Add a Content revision: ID filter. Set the operator to Is equal to, and input -1

  2. Click Add in the No results behavior options box and add Response status code

  3. Select 404 (Not Found) as the status code to return and add it

  4. Save the view

Step 1 adds a filter that will always fail, because revision ids are positive integers, thus never equal -1. This will make the query always return with no results.

Steps 2 and 3 make Drupal return a proper 404 HTTP code when no results are returned from the query.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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