Drupal, auto-generate article urlpath based on menu path

242 Views Asked by At

I am using Drupal 7 to build a website. I am facing this issue. I have a page that shows a list of articles. Once I click on an article to view its full content, the urlpath does not follow the menu active trail anymore.

Now a bit of explanation. I have created this menu structure. There is a main page called "Resources" (urlpath: resources). It has one child page called "Articles" (urlpath: resources/articles). I have created a view that shows a list of articles based on a certain tag. I have set the urlpath of the view to "resources/articles" so that it would show up on the "Articles" page. This whole idea work as I want it to. Now comes the problem.

In the list of articles, when I click on a specific article (e.g. My Test Article), the urlpath changes into "my-test-article". I would expect it to be "resources/articles/my-test-article". So overall my URL would look like this http://www.domain.com/resources/articles/my-test-article. Now it looks like this http://www.domain.com/my-test-article.

Because of this behavior, I lose breadcrumbs and active menu trail. I know that articles are not linked to a certain parent and I know that one article can show up in different views on different pages so this kind of makes sense. Still I believe there must be a way to simulate this "article belong to parent" functionality.

I have Pathauto module installed and working for basic pages that have a menu link. Still it does not do anything for articles. It has lots of patterns so I might as well have missed the right one. Now I only have the default path pattern set to [node:menu-link:parents:join-path]/[node:title].

I can manually alter the urlpath of every article but this looks like a primitive option. Then of course I can have one article show in more than one page so different urlpaths are needed.

I am new to Drupal so maybe I miss the right approach. Can anyone point me into the right direction? Help is greatly appreciated.

1

There are 1 best solutions below

0
On

Make sure every article is assigned to a menu. You can use Menu Position to automatically add specific content types to a menu. There is also a way to hide these auto generated items from the menu I don't remember the method for achieving this but will update and let you know. For example I have a view that list all press releases but I don't want the list of press releases in the menu.