fix: 🐛 fix handling of URLS (now uses config file prefix)
This commit is contained in:
parent
c60b052951
commit
0f2634749d
2 changed files with 17 additions and 5 deletions
|
@ -96,9 +96,6 @@ class Post implements ArrayAccess {
|
|||
$data['basename'] ??= 'root';
|
||||
}
|
||||
|
||||
$post_data['host'] ??= 'localhost:8081';
|
||||
|
||||
$data['url'] ??= 'http://' . $post_data['host'] . $post_data['path'];
|
||||
|
||||
$data['basename'] ??= basename($data['path']);
|
||||
$data['title'] ??= basename($data['path']);
|
||||
|
@ -107,6 +104,17 @@ class Post implements ArrayAccess {
|
|||
|
||||
$data['type'] ??= self::deduce_type($post_data['path']);
|
||||
|
||||
if(!isset($data['url'])) {
|
||||
$url = $site_defaults['uri_prefix'] . $post_data['path'];
|
||||
// Adding a trailing slash for "non-filename" paths that
|
||||
// need a trail to render properly
|
||||
|
||||
if(!preg_match('/\.\w+$/', $url)) {
|
||||
$url .= '/';
|
||||
}
|
||||
$data['url'] = $url;
|
||||
}
|
||||
|
||||
$data['icon'] ??= self::deduce_icon($data['type']);
|
||||
$data['template'] ??= self::deduce_template($data['type']);
|
||||
|
||||
|
@ -234,4 +242,4 @@ class Post implements ArrayAccess {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue