created option for breadcrumb style titles
This commit is contained in:
parent
4a504b985f
commit
488704e307
9
README.md
Normal file → Executable file
9
README.md
Normal file → Executable file
@ -243,6 +243,15 @@ By default, Daux.io will create clean url's that do not include index.php. On se
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
###Breadcrumb titles
|
||||||
|
Daux.io provides the option to present page titles as breadcrumb navigation.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"breadcrumbs": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
###Date Modified
|
###Date Modified
|
||||||
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
|
By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to false.
|
||||||
|
|
||||||
|
29
libs/functions.php
Normal file → Executable file
29
libs/functions.php
Normal file → Executable file
@ -30,7 +30,8 @@
|
|||||||
'ignore' => array(),
|
'ignore' => array(),
|
||||||
'languages' => array(),
|
'languages' => array(),
|
||||||
'file_editor' => false,
|
'file_editor' => false,
|
||||||
'template' => 'default'
|
'template' => 'default',
|
||||||
|
'breadcrumbs' => false
|
||||||
);
|
);
|
||||||
|
|
||||||
// Load User Config
|
// Load User Config
|
||||||
@ -165,10 +166,14 @@
|
|||||||
$page['modified'] = filemtime($file);
|
$page['modified'] = filemtime($file);
|
||||||
|
|
||||||
$Parsedown = new Parsedown();
|
$Parsedown = new Parsedown();
|
||||||
|
|
||||||
$page['content'] = $Parsedown->text($page['markdown']);
|
$page['content'] = $Parsedown->text($page['markdown']);
|
||||||
|
|
||||||
|
if ($options['breadcrumbs']) {
|
||||||
|
$page['title'] = url_to_title(get_url($file), 'Colons');
|
||||||
|
} else {
|
||||||
$page['title'] = clean_url($file, 'Title');
|
$page['title'] = clean_url($file, 'Title');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$relative_base = ($mode === 'Static') ? relative_path("", $file) : "http://" . $base_path . '/';
|
$relative_base = ($mode === 'Static') ? relative_path("", $file) : "http://" . $base_path . '/';
|
||||||
ob_start();
|
ob_start();
|
||||||
include($base . "/template/" . $template . ".tpl");
|
include($base . "/template/" . $template . ".tpl");
|
||||||
@ -177,6 +182,26 @@
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Converts a URL to a readable breadcrumb string for the page title
|
||||||
|
function url_to_title($url, $separator = "Chevrons") {
|
||||||
|
$url = str_replace("index.php?", "", $url);
|
||||||
|
$url = str_replace("_", " ", $url);
|
||||||
|
switch ($separator) {
|
||||||
|
case 'Chevrons':
|
||||||
|
$url = str_replace("/", " <i class=\"glyphicon glyphicon-chevron-right\"></i> ", $url);
|
||||||
|
return $url;
|
||||||
|
case 'Colons':
|
||||||
|
$url = str_replace("/", ": ", $url);
|
||||||
|
return $url;
|
||||||
|
case 'Spaces':
|
||||||
|
$url = str_replace("/", " ", $url);
|
||||||
|
return $url;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
// File to URL
|
// File to URL
|
||||||
function clean_url($url, $mode = 'Static') {
|
function clean_url($url, $mode = 'Static') {
|
||||||
global $docs_path, $output_path, $options;
|
global $docs_path, $output_path, $options;
|
||||||
|
Loading…
Reference in New Issue
Block a user