0

I have a very important tag list (over 100k) (drupal 8).

I'm using the default view of taxonomy.

I need a form in my navbar that allows me to redirect to the different lists related to my tags generated with taxonomy view.

For example:

  1. I type in the form "term 1",
  2. then appears the list of all the contents tagged with the "term 1", with for url mysite/term-1 (important).

I tried to modify the taxonomy view with an exposed form but it does not work, because it is necessary that the form allows to search in all the site and not to filter the list displayed.

I tried to create a content view with an exposed form to sort by terms of taxonomy, it works but I have url problems not optimal for SEO (ex: mysite/myview?tid=taxonomy+term+(3)).

I thought of an element of type select with autocomplete (as chosen) but considering the number of tags I do not think it is recommended. Creating a menu seems to me also not recommended.

In short, I do not find the solution!

Does somebody have an idea ?

2
  • Your example isn't clear. When search for a term in some autocomplete field, do you want to see a suggestions list or a views results list? Do you want to see a list of nodes tagged with that term and where? Or do you just want to see one link linking to the term page? BTW to get the term name instead of the term ID in the URL Duplicate the Taxonomy term views and add Relationship to the term and replace the Contextual for TID with the one for term name.
    – prkos
    Commented Feb 23, 2019 at 1:20
  • I need to have 1 / search suggestions and 2 / once selected the suggestion or typed the taxonomy term arrived on a page showing me all the nodes related to the selected taxonomy term with for url (mysite / taxonomy_term). Important: I have several taxonomy vocabularies (currently it seems to be possible to indicate only one vocabulary)
    – Hgfdsoiu
    Commented Feb 25, 2019 at 14:30

1 Answer 1

0

To get the form with a suggestions list like that you need to create an exposed filter in your content Views and use Exposed form in block option. Place the block in a region of your theme.

To get the autocomplete suggestions list for taxonomy terms use the Has taxonomy terms filter and set it to Autocomplete.

The Global filter doesn't seem to work with taxonomy fields, I'm not sure if there are combinations you can try to make it work and have all the vocabularies terms searchable in one field.

The default Taxonomy term Views contextual filter needs to be removed since it won't work with only exposed filter output unless you use Views Filter Harmonizer.

Query Parameters To URL can help with the SEO side of things.

To get the Term name into your content Views instead of the TID you have to add a Relationship to the related Taxonomy term field. Then you'll be able to add Fields, Filters and Contextual filters based on the "Name", but the widgets might not offer autocomplete or other options you have under "Has taxonomy term".

Alternatively you can create a "Taxonomy term" TYPE of views where you can get the Name filter for all vocabularies, but no autocomplete.

(Add Relationship to content so you can show nodes in the results.)

Search Autocomplete might help partially, maybe you can get it to direct to a specific views page with the result as argument.

Using a more powerful Search API or other search features related to Views might allow you to achieve everything you're asking about.

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.