PrettyPath
Component ID
2050427
Component name
PrettyPath
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Component created
Component changed
Component body
An experimental sandbox to convert paths with query parameters to prettier ones: e.g.:
my-view?page=1=>myview/page-1.
Purpose
This module provides a configuration for prettifying paths. Prettifying means to
replace query parameters with parts of the path. You e.g. may want to append the
page number to the path, isntead of carrying as query param.
Altering paths this way, may not have a big impact on SEO, so most times it may
not be worth the effort to deal with maybe occuring side effects. But if you
need exactly that behaviour, try this module and please give feedback, so we may
know what pitfalls this approach comes with.
Settings
The module is configured via hook_prettypath_config().
Example:
?type=articlewill be replaced and appended as/type-article?page=15will be replaced and appended as/page-15
/**
* Implements hook_prettypath_config().
*/
function mycustom_prettypath_config() {
$config = array(
'path' => '*',
'segments' => array(
array(
'segment position' => 'auto',
'type' => 'single',
'force' => TRUE,
'prefix' => 'type-',
'items' => array(
array(
'item' => array(
'type' => 'facet',
'facet' => 'type',
),
),
),
),
array(
'segment position' => 'auto',
'type' => 'single',
'force' => TRUE,
'prefix' => 'page-',
'items' => array(
array(
'item' => array(
'type' => 'get',
'key' => 'page',
),
),
),
),
),
);
return array($config);
}
Known Issues
- When using with globalredirect module, you should apply the patch from #2060123: Do not use altered options for url_outbound alias.
