I'm trying to build a news/blog feed for each of our internal departments. I have a vocabulary with terms for each department, and have successfully created a panels page at extranet/news/<tid> which displays a content pane view of the most recent N posts. The departments want to be able to alias their newsfeed, to something like hr-news, so add a url alias hr-news => /extranet/news/<tid-for-hr>. This all works fine thus far.

The problem comes when I try to put a summary view in another pane on the same panel to link to previous months of posts, where the goal would be to use a path like hr-news/2011/10 or similar. But to do this, it seems that I would have to create a url alias for each month/year/department combination.

The other option would be to use GET parameters, but I cant figure out how to load a GET parameter into a panels context so i can pass it to the view. Am I approaching this problem wrong?

  • I'm a bit confused, your panel path uses hr-news => /extranet/news/%tid-for-hr (?), how does hr-news/2011/10 come into play?
    – Ashlar
    Commented Feb 1, 2012 at 16:51
  • hr-news/2011/10 would filter the list of news articles to those written in October 2011. So i have a view with 2 parameters, taxonomy id and an optional year/month. I'd like the panel which displays this view to include one of these parameters (the term) as part of it's url alias, while the other parameter should be specified by an addition to the alias. Does that make more sense?
    – adharris
    Commented Feb 1, 2012 at 17:06

2 Answers 2


I have a similar problem on a Drupal 7 site, and am posting as much to share my solution as to "subscribe" and hear from others about the potential pitfalls or alternative solutions.

In my case, I have a number of panels that display "related" content to a node.

Let's say that it's an artist node, and that I have a few panels or variants representing the

  1. artist (url artist/[artist-nid])
  2. their albums (albums/[artist-nid])
  3. their band history (history/[artist-nid]).

For SEF urls, I want to alias those to something like

  1. artist-name-profile
  2. artist-name-albums
  3. artist-name-band-history

Because pathauto doesn't "see" the panels, and because the urls are of an unusual structure (no '/' ) I wrote a custom module to do url rewriting using hook_url_inbound_alter() and hook_url_outbound_alter().

For Drupal 6 you can use http://drupal.org/project/url_alter It's baked into Drupal 7.

So basically, I maintain a cck field on the artist node containing a url friendly version of the artist name. Then use code something like the following.

function myModule_url_outbound_alter(&$path, &$options, $original_path) {
  $parts = explode('/', strtolower($original_path));
  $prefix = array_shift($parts);

  switch($prefix) {
    case 'albums': 
      if (!empty($parts[0]) && is_numeric($parts[1])) {
        $url_fragment = myModule_get_unique_url_safe_artist_name($parts[1]);
        $path = $url_fragment.'-albums';
    // etc

function myModule_url_inbound_alter(&$path, $original_path, $path_language) {
  $parts = explode('-', strtolower($original_path));

  $suffix = array_pop($parts);

  switch ($suffix) {
    case 'albums':
      $map = implode('-', $parts);
      $nid = myModule_get_nid_from_unique_url_safe_artist_name($map);
      $path = 'albums/'.$nid;
    // etc


  • I get a great deal of flexibility on the url design - non-conventional urls are possible
  • I do not need to have over 50,000 records in the url_alias table.
  • I can quickly and easily change the urls without having to rebuild the alias table
  • I can reach those pages pathauto can't
  • It works.


  • every url passes through this test and the ones that match will be slowed down by at least one db query. (this doesn't appear to be much of a performance hit by YMMV)
  • url changes require developer intervention
  • For large numbers of panel variants, this function can become difficult to maintain, particularly because you have to be careful not to allow conflicts to arise. See below for example.
  • This doesn't smell right as an approach

Conflicts can come up based on your url matching methodology. I the above case we split on '-', this can become a problem in this specific case if the artist url were simply artist-name and the artist's name was literally "Michael-albums" since this would be interpreted as an album page for "Michael" rather than an artist page for "Michael Albums".

  • In thinking about your specific case, you may be able to use something like drupal.org/project/subpath_alias Commented Feb 5, 2012 at 7:26
  • Excellent write up! It seems my use case is a bit simpler than yours, so it doesn't feel quite as hacky for me. My initial plan was using the url_rewrite hook, but i forgot that was a d7 addition. Silly me for forgetting that most d7 functionality can be added from contrib! I think you're right, the subpath_alias is going to probably gonna get me there, so that's what I'll start with. Thank you much!
    – adharris
    Commented Feb 7, 2012 at 14:56

Path aliases are a second name for a URL call for Drupal. Drupal actually only understands several URL paths (/node/nid, taxonomy/term/tid, /user/uid...)everything else is jibberish, except when aliases are turned on, Then you can make substitutions. When a URL is passed to Drupal with aliases, it translates that alias into a URL it understands very early in the process. When you create an alias such as extranet/news/%tid-for-hr, it is quickly translated and for your purposes the alias is really not used again. You certainly cannot have two path aliases and use one to pass context information to the view or panel. In fact you cannot get a view page to read an alias at all because the URL is changed to its Drupal form before Views gets it.

If you want to filter the content further with a contextual filter, you will need do so through the content of a field or by making a relationship with a node that can pass your information to the view.

I am also wondering if you are making this to difficult. Somewhere, you are going to have to define the filter dates so that the view can be filtered. Why not do it in the view itself. This would mean only one place to make the setting. If you want, you could expose the filter so that the user could set his/her own desired date.

If I've missed the point, please let me know.

  • the 2011/10 is not a views filter, it's a views argument. The links to the hr-news/201110 is built using the "summary view" option for that views argument, which allows views to display a summary of a missing argument (in this case month and year). Taking the panel out of the picture for a second the views page path would be extranet/%/%, where the first % is a term id and the second a month and year. HR wants to be able to alias the first part to hr-news, so the view path would essentially be hr-news/%, where the wildcard is now just the month/year, with the tid absorbed by the url alias.
    – adharris
    Commented Feb 1, 2012 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.