2

I created a forum on a site using the core Forum module. When we create a new forum, Drupal creates it as a taxonomy term. When we create the new forum, if we associate a path alias, that URL alias is only associated to the taxonomy term and not to the forum. If we click on a specific forum from the index page (example.com/forum) we are sent to example.com/forum/nn.

How can I associate a path alias? I'm not being able to do it via the Pathauto module. Can someone tell me how to do it with that module or using any other solution?

  • The Pathauto module does support the Forum module. What did you get from it, and how did it differ from what you expected to get? – kiamlaluno Apr 22 '18 at 20:14
  • I was able to get a path alias for each forum, using the Pathauto module, but it seems that in the /forum page (the one listing all the existing forums) the path aliases aren't used. I get the path alias in the page showing a forum topic, in the link to to the forum. – kiamlaluno Apr 22 '18 at 20:50
  • As I pointed out below you solved my issue teaching me an additional functionality of Path/pathauto (The generation of individual alias, that I didn’t realise it was still available after installing Pathauto). Regarding the Pathauto usage I think that there might be a bug ibn it, because after enabling the forum module (from the core), when I tried to use the “Bulk Generation”, I had available a “Forum” option on the sub tab: “Select the types of paths for which to generate URL aliases”, but, at the same time on the tab: “Settings”, subtab: “ENABLED ENTITY TYPES” there is no “Forum” option – Henrique Moreira Apr 23 '18 at 11:25
  • After I created a Pattern of type: “Forum”, and that Pattern runs, but doesn’t generate Alias. May be a Drupal Apprentice with 5 months experience shouldn't use the word “bug” but I think the interaction of Pathauto and Forum modules is not working properly. If you want I will give you “admin” permission to my site so that you can inspect it. Nevertheless your solution solved my issue via the individual alias generation, and I’m very thankful to you. – Henrique Moreira Apr 23 '18 at 11:26
  • Yes, it is a little confusing that in the settings you don't explicitly enable the automatic path aliases the Pathauto module creates for forums, but you need to select Forum when you create a pattern for path aliases. It is even more confusing that the path aliases assigned to forums are really assigned to the taxonomy terms associated to the forums. I added the screenshots to show the Pathauto settings I used in the test site. – kiamlaluno Apr 23 '18 at 13:03
4

It is possible to add a path alias to a forum, without installing any third-party modules.
You could install the Pathauto module, but that is more for automatically assigning the path aliases when creating/editing an entity, or for bulk-assigning path aliases to existing entities. If you install the Pathauto module to create path aliases for the forums, notice that under Enabled entity types on /admin/config/search/path/settings, you don't see an entry like Forum. Use the default values for that form field (which include Content and Taxonomy term that you cannot deselect), and you will be able to set path aliases for the forums.

screenshot

It is a quite confusing, since in /admin/config/search/path/patterns/add you need to select Forum for Pattern type.

screenshot

Maybe it would be less confusing if Forum would be an option for Enabled entity types too.

In this case, anyway, the path aliases that the Pathauto module says to assign to forums are really assigned to the taxonomy terms associated with the forums. The effect of this is that the /forum page would not use any path alias for the forum links.

I created a sandbox site on simplytest.me, and I just enabled the Forum module. I created two forums (Module development and Theme development), and created a forum topic (Porting the "User activity" module to Drupal 8). I went to /admin/config/search/path, and created the following path aliases.

  • /forums/1/general-discussion pointing to /forum/1
  • /forums/2/module-development pointing to /forum/2
  • /forums/3/theme-development pointing to /forum/3

Doing so, the /forum page used the path aliases I set, in the links to the forums, but the forum topic pages used links like https://dsze.ply.st/taxonomy/term/2 under Forums.

So, or you set a path alias that is used from the /forum page (but not from the forum topic pages), or you set a path alias that is used from the forum topics page (but not from the /forum page), or you set two different sets of path aliases (a set used from the /forum page, and a set used in the forum topic pages).

  • 1
    My most Sincere gratitude for the solution and lesson on Drupal. You are not only an expert, but you invest your time to help the apprentices like me. Rare and remarkable, thank you very much – Henrique Moreira Apr 23 '18 at 11:02

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.