📜 ⬆️ ⬇️

New Handy alias module for flexible page synonym creation

Friends, I want to introduce you to the new module Handy Alias .

I have to say, this is a module for perfectionists. In a nutshell, it allows you to attach pseudonyms to dictionaries, terms, and nodes, which you can later use as material to form a path with the help of your beloved pathauto, by analogy with the [termpath-raw] token. This solves problems with transliterated ugly page addresses and the display of the dictionary structure in the URL. In addition, for specified types of content, you can configure the addition of a pseudo-extension .html, but this is for those who know a lot about perversions.

Below I will try to explain the essence of the module .
By the way, I will be glad to hear your feedback, suggestions and suggestions. In addition, I intend to use you as free testers =)

So, step by step guide to action on the example of the site on automatics:

  1. Download and install modules Handy Alias , token , Pathauto 2.x
  2. Create a type of material "car". For the created material, enable the option "Enable handy alias for this content type" and "Attach .html pseudo-extension to node aliases". This will allow us to create aliases when creating car-type materials that are available under the token [node-handy-alias]

  3. Next, create a dictionary "Types of cars." Enable the option "Enable handy alias for terms of this vocabulary". It is also necessary to indicate the types of content for which this dictionary will be used as a “supplier” of aliases. In our case, this is a “car”. Supplier of aliases ... Lord! Easier to show the code than to describe how and what it does! Yes, and besides, it is possible, but not necessarily, to assign an alias to the dictionary itself (it will be available under the token [vocab-handy-alias] ). Honestly, I'm not sure that I myself fully understand why this token is needed, but it exists and works, it is a fact!

  4. By the way, after you enable the “Enable handy alias for terms of this vocabulary” option, the dictionary features like “Tags”, “Multiply select” and the ability to select multiple parents for the term will be automatically disabled.

  5. Now it remains to fill the dictionary with the tree of terms, set for each of them synonymously and ...

  6. ... go to the settings for address patterns in pathauto. Namely, we go to the Patterns section and set alias patterns for the type of material “car” and the terms of the “Car Types” dictionary as follows: [vocab-handy-alias]/[term-handy-alias-path]/[node-handy-alias] and [vocab-handy-alias]/[term-handy-alias-path] respectively

  7. Everything! Preparation is over, time to create content. When creating the material, we can observe an additional field under the heading where you can specify an alias for the node. If not specified, node id will be used.

  8. Click save and enjoy a cute urla in the address bar

  9. And then we create a couple of representations, one of which we override the standard system path “taxonomy / term /%”, etc.

  10. In short, a few minor improvements and your new wonderful site is almost ready!

Here is such a module. I'm still not sure that anyone except me needs him, but he is there, uploaded on drupal.org and wants to be useful to people!

Source: https://habr.com/ru/post/104850/

All Articles