0

I have several contentypes, url alias are working fine, by default if there is a space in node title (or another token) is replaced with a dash "-", is it posible to change that beheavior by contentype and only on this special contentype replace spaces with nothing? example: my special contentype node title is= "word1 word2", this is replaced by "word1-word2", and i need to be "word1word2".

EDIT: i have allready pathauto module installed and working, path aliases are working fine, i need to change de default separator settings from a dash to "nothing" in one contentype only. Both answers bellow do not help me.

2

Yes. You can use the pathauto module.

http://dgo.to/pathauto

  • Thanks Jaypan, i have pathauto enebeled and working, but "replacement patterns" in url are global in admin/config/search/path/settings, i can not change it by content type, or maybe i do not undesrtand your answer. – pinueve Mar 22 '18 at 4:00
  • Ahh I see. Yeah, I think those rules can only be set globally. The only way I could see to do what you want is to create your own implementation of hook_node_insert() and hook_node_update(), and set the path in there according to the rules you want. – Jaypan Mar 22 '18 at 4:16
  • You can change it by content type using pathauto. I wrote out the steps in an answer. – Matt Mar 23 '18 at 21:20
  • Jaypan answer do not help me at all, please read carefully my question, i need to change the "settings" (admin/config/search/path/settings), the default separator is a dash and needs to be "nothing" only in one contentype. i do not understand why this answer has 2 votes up. – pinueve Mar 23 '18 at 21:42
  • Because it was the right answer, according to the original question. The additional information provided has shown that my answer was not enough. – Jaypan Mar 23 '18 at 23:30
0

To have a unique replacement pattern for every content type follow these instructions:

Like Jaypan said use the pathauto module https://www.drupal.org/project/pathauto then

  1. Click on configuration in the admin menu
  2. Click URL aliases
  3. Click the Patterns tab at the top
  4. Click 'Add Pathauto Pattern'
  5. For pattern type choose 'content', and give it a name
  6. After saving click edit to the right of the pattern you just created
  7. You should have a list of content types you can choose to have this pattern applied to.
  8. Enter in the pattern using whatever tokens you need
  9. Repeat these steps for each content type you want to have a custom path pattern
  • thanks Matt, but please read carefully my question, this answer and Jaypan answer do not help me at all, i need to change the "settings" (admin/config/search/path/settings), the default separator is a dash and needs to be "nothing" only in one contentype. – pinueve Mar 23 '18 at 21:39

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.