Hi,
I am running drupal 8.3.5 and I want to use pathauto for forum and container.
When I create an alias for pattern type forum, I can only choose taxonomy tokens,
there are no tokens for forum.
So I choose : /forum/[term:name]
When i do a bulk generate then the following alias is created for the default general discussion forum :
/forum/general-discussion : /taxonomy/term/1
When I go to my drupal home pages and I select the forum, this alias is not used.
The url that is used is : http://host:port/forum/1
When I create the alias for the forum manually :
/forum/general-discussion : /forum/1
It works when I go to the home page and select the general forum.
Am I missing something or is this a bug ??
Comments
Comment #2
jhmnieuwenhuis CreditAttribution: jhmnieuwenhuis commentedComment #3
jhmnieuwenhuis CreditAttribution: jhmnieuwenhuis commentedComment #4
newkew CreditAttribution: newkew commentedHi,
same issue for me with drupal 8.3.7 and last pathauto ~8
pattern : /[term:parent:name]/[term:name]
all alias generated are ok but for /taxonomy/term/2 and not forum/2
Comment #5
lelik1973 CreditAttribution: lelik1973 commentedThe same problem in drupal 8.6.4
Comment #6
TikaL13 CreditAttribution: TikaL13 commentedHaving the same issue with the following versions:
Comment #7
Morbus IffUsing 8.6.10, a similar problem is happening for users:
* user/[user:account-name]
* account/[user:display-name]
* morbus/[user:uid]
None of the above work.
Comment #8
Berdirthat has nothing to do with this. Is the pathauto widget visible or not? If not, there's an issue open where people report problems when the widget is not active, might be that.
Comment #9
Morbus IffConfirmed. Sorry.
Comment #10
maenjuelI encountered the same problem. If I let pathauto do the work automatically, the links on /forum don't get converted. It doesn't matter whether I chose taxonomy term or forum as pattern type. However, adding the alias manually does the trick.
Looking at the URL aliases, I realized when pathauto adds the alias automatically, it adds English as the language (even though I haven't enabled any language modules). Adding a link manually just adds none (und in the database) to the language. The column language was not even on the URL aliases page before pathauto created the first alias. So I guess that a language is defined doesn't matter for nodes and their aliases, but /forum seems to be a special case.
Comment #11
maenjuelI've looked again this morning, and I don't think it has anything to do with the language. If I chose forum as pattern type, it creates a link for the taxonomy term only (taxonomy/term/X), but not for /forum/X. So, the forum pattern type does exactly the same thing as the taxonomy term pattern type.
I'm not very strong in PHP, so I don't see the problem in the code. I look into the code a bit more, but I'm not sure if I'll be able to get at the bottom of it, tbh :)
Comment #12
MartinMa CreditAttribution: MartinMa as a volunteer commentedThis issue seems to be a problem of communication or documentation. For me too it was not clear, that "forum" in the pathauto pattern menu mean the taxonomy of the forums and not the content type of the forum. You have to set up a pattern extra for the content type of forum.
Maybe "forum categories" in pattern menu and bulk creation menu would be a proper term/description instead of "forum".
If I read the term "forum" for me its the whole forum and not only the categories of the forum!
Comment #13
maenjuelI'm not sure we need to rename "forum" to "forum categories". We have different things pathauto needs to take care of with the forum module:
- content type
- taxonomy term
- forum category and container URLs (forum "front-end", to actually browse through the forums)
The first two cases can be easily managed by the normal content type and taxonomy pathauto pattern. So, I'd argue "forum" can remain "forum" in the pathauto pattern menu, since it refers to a special case for the third item in the list above. The bug report doesn't refer to content type or taxonomy term of the forum, but to the URL of the forum view (or "front-end", for the lack of a better term) itself.
Comment #14
brunodboRan into this as well.
I also noticed that when I go to a forum taxonomy term's alias, I end up on a regular taxonomy page, instead of a forum page. So I wonder if somehow Drupal is not connecting the term and the forum on some level.
As described above, if I hover on a forum link on
/admin/structure/forum
, I see the unaliased URL in my browser's status bar, instead of the alias, even though the alias is set on the forum's edit form (e.g.,/admin/structure/forum/edit/forum/1
, which is the same as the forum's term alias).Comment #15
Jhun Vert CreditAttribution: Jhun Vert commentedI encountered similar behavior as described in the original post.
Drupal 8.8.5
Pathauto 8.x-1.6
Comment #16
XTazSame as original post for me too after cleaning caches with:
Drupal 8.8.5
Pathauto 8.x-1.8
Comment #17
DrupalBubb CreditAttribution: DrupalBubb commentedDon't choose the forum pattern type, it always creates taxonomy terms. But you can set up the correct path through the mechanism by individualy changing the system path from /taxonomy/term/ to /forum/ for all forum entries.
Is noone able to provide a patch for this easy code change?
Comment #18
brunodboIf I'm understanding #2680503: Fatal error: Call to a member function get() on null in [mysite]/modules/pathauto/src/Plugin/pathauto/AliasType/ForumAliasType.php on line 45 correctly, this issue is related to the work being done in #2010132: Canonical taxonomy term link for forum vocabulary is broken, so re-rolled the patch there to move that issue along.
Comment #19
cptX CreditAttribution: cptX commentedHi, any news about this? The same issue happens in Drupal 9.1.2. I'm unable to make a pattern for forums content types. They just don't work. Any workarounds or suggestions for some automation and not manual editing for every category?
Comment #20
eL CreditAttribution: eL commentedDrupal 9 and Forum - containers not aliased with pathauto. So same problem here.
Comment #21
DrupalBubb CreditAttribution: DrupalBubb commentedComment #22
C.Riemer CreditAttribution: C.Riemer commentedHello,
same problem here. Drupal 9.1.8. What is the solution?
Regards.
Comment #23
leisurman CreditAttribution: leisurman commented@brunodbo I see the same thing. I have set the pattern for forum to
forums/[term:parent:name]/[term:name]
When I am in node edit mode for a container or its child forum, the genrated alias looks correct/container1/forum1
. But when I veiw the fourm, the url path looks like thishttp://mysite/forum/220
Is there a workaround?Comment #24
ryankavalsky CreditAttribution: ryankavalsky commentedThis workaround is by no means official, but it's working for us in the meantime. Since Drupal can link to these forums from so many places (menus, breadcrumbs, other forums, taxonomy pages, forum tables, etc), I've had to create a good amount of overrides to get it all covered.
I have a custom module with event subscribers that I've coded to intercept taxonomy requests that are actually for forums, and redirect the request to the appropriate forum page using the desired forum URL.
[custom module]\src\EventSubscriber\SharedEventSubscriber.php:
This custom module also deletes the taxonomy path for forums (/taxonomy/term/xx) and creates the forum path (/forum/xx). It also saves an alternative URL to whatever PathAuto was trying to set in the first place, appending "-taxonomy-alias" to prevent duplicates.
[custom module]\shared.module:
I also have a custom theme that have overrides for the forum list and forum entity reference fields.
[custom theme]\templates\forum-list.html.twig:
[custom theme]\templates\field-node-taxonomy-forums–forum.html.twig:
I hope this helps in some way!
Comment #25
leisurman CreditAttribution: leisurman commented@ryankavalsky. I could not get it to work. Is there a services.yml file? Is is possible to upload the full code for each file you used?
Comment #26
ryankavalsky CreditAttribution: ryankavalsky commented@leisurman Unfortunately this code is part of a much larger custom module and custom theme that I won't be able to include here. You might have to familiarize yourself with setting up an event subscriber: https://www.drupal.org/docs/creating-custom-modules/subscribe-to-and-dis....
I do have a services.yml file in my solution:
And I also have this code block in SharedEventSubscriber.php:
Comment #27
leisurman CreditAttribution: leisurman commented@ryankavalsky. Thank you. I will try again. I noticed @brunodbo #14 above. This is already being worked on #2010132: Canonical taxonomy term link for forum vocabulary is broken. In Drupal 7 there was a Pathauto pattern called Drupal 7 Pattern for 'Pattern for forums and forum containers' And this pattern worked well
[term:vocabulary]/[term:parent:parent:parent:name]/[term:parent:parent:name]/[term:parent:name]/[term:name]
'Pattern for forums and forum containers' is not available in Drupal 8/9.
Comment #28
leisurman CreditAttribution: leisurman commented@ryankavalsky. This patch fixed the forums and forum containers url problem on Drupal 9.2.6. 2010132 Canonical taxonomy term link for forum vocabulary is broken
Comment #29
ryankavalsky CreditAttribution: ryankavalsky commentedThanks @leisurman! I'm still on Drupal 8, though.