6

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?

3
  • only for one term or for all the vocabulary? Commented Aug 29, 2017 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
    Commented Aug 29, 2017 at 19:06
  • in this case check my answer and you will find your solution. Commented Aug 29, 2017 at 19:10

3 Answers 3

2

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.

2
  • it doesn't help in this issue! I just want to prevent drupal from listing nodes in taxonomy page.
    – shekoufeh
    Commented May 22, 2019 at 14:36
  • @shekoufeh your problem is different from the problem asked in the question. Commented May 22, 2019 at 15:22
23

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

... and restrict the access.

4
  • it is the best solution. you saved me a lot of time and energy. thanks.
    – shekoufeh
    Commented May 22, 2019 at 14:38
  • Simple and easy without needing to install anything. This should be the selected answer!!!
    – Sam
    Commented Nov 21, 2019 at 16:07
  • 1
    Why not disabling this view all together?
    – gagarine
    Commented Jan 15, 2020 at 17:53
  • When you use this solution, and you make use of the taxonomy menu module (drupal/taxonomy_menu), there will be no menu items in the menu.
    – C.A. Vuyk
    Commented Sep 16, 2020 at 7:44
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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