SEO-friendly URL
Multiple Panel variants for one node with SEO friendly paths
If you wanted to display a nodes comments or maybe a cck multiple imagefield in its own view you would have to build urls like "node/123/comments" or "node/123/images". Panels can easily do this by creating a panel like "node/%/comments". But it would be nice if we could use a path alias like "dog/odin/images". Panels and views might be able to use a nodes title as argument but the path alias would be rewritten to be URL conform.
Gladly we can use smk-ka's module Subpath Alias. This module extends the URL alter Modul and extends the alias of a node. By this a given path "dog/odin/images" translates into "node/123/images" and we can easily access the integer id of the node again to build our data.
We now can setup a panel for "node/%node". Than we can add a variant filters for the nodetype "dog" and a PHP snippet. Use this snippets for an eval() call. Be sure not to use < ? php and ? >.
<?php
return drupal_match_path($_GET['q'], '*/images');
?>drupal_match_path() is a very useful function that you might know because the block system uses it for URL matching. If this evaluates to true and the nodetype fits the panel variant will be used. By this we now can use panels or views with easy integer arguments but show SEO friedly URLs to the world. The only thing we now need to add are some context sensitive links so the user can easily navigate the site and benefit from this..







Kommentare
Hello Ben,
it does no matter which way you choose to rewrite or construct your links. You can do this via custom modules, rewriting links via views or manage this manually.
The trick is, that drupal "understands" those links and could display different panel variants according to path-suffix.
Hope that helps,
Ralf