orderable urlalias

sest - April 2, 2008 - 13:16
Project:Path
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

It would be a good feature if the urlalias are orderable, aka weight in menu. So if you have more then on alias for a node you can choose the preferred alias. It would be also easier to rename nodes who are in the cache of a searchengine.
Maybe a easy way would be column weigth in table 'url_alias'. And on load "ORDER BY weight "

#1

miche - June 26, 2009 - 20:51

I agree. Every alias gets a 'pid'. If you set your Path configurations to keep old alias and add new alias, AND have GlobalRedirect installed, your new aliases never get used.

I propose a change in drupal_lookup_path. When fetching available aliases, although several might get returned, it only grabs the top one (due to db_result). Since the query is only sorting on language, it is possible you get get an old one.

OLD CODE

<?php
// Get the most fitting result falling back with alias without language
$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language));
?>

NEW CODE

<?php
// Get the result with the highest pid (most recent) with appropriate language
$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC, pid DESC", $path, $path_language));
?>

So, your request to have a weight column could be solved with the current schema if you knew that the most recent alias was going to be used.

Does anyone have a reason why this would be a bad idea?

 
 

Drupal is a registered trademark of Dries Buytaert.