mirror of
https://github.com/lrsjng/h5ai
synced 2025-12-06 08:52:45 +01:00
Merge f3abc14353 into aa94de4945
This commit is contained in:
commit
b063abb46e
5 changed files with 24 additions and 4 deletions
|
|
@ -26,6 +26,17 @@
|
|||
]
|
||||
},
|
||||
|
||||
/*
|
||||
Custom Page Titles
|
||||
- Placeholders available: DIR, PATH
|
||||
- Link on "mydomain.com/foo/bar" with Pattern "MyShare DIR - PATH" generates "MyShare bar - foo/bar"
|
||||
- If DIR is "" (doc root) fallback to "index"
|
||||
(title has 65 and meta has 155 max. chars)
|
||||
*/
|
||||
"pagetitle": {
|
||||
"title": "DIR - powered by h5ai",
|
||||
"desc": "shared files: PATH"
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -289,6 +289,18 @@ class Context {
|
|||
|
||||
$html = '';
|
||||
|
||||
$title = $this->query_option('pagetitle.title', "DIR index - powered by h5ai");
|
||||
$meta = $this->query_option('pagetitle.desc', "shared files in PATH");
|
||||
|
||||
$path = trim($this->setup->get('REQUEST_HREF'), '/') ?: "index"; // fallback to index if root
|
||||
$dir = substr(strrchr($path, '/'), 1) ?: $path; // fallback to dir = path if path contains no /
|
||||
|
||||
$title = str_replace('DIR', $dir, str_replace('PATH', $path, $title));
|
||||
$meta = str_replace('DIR', $dir, str_replace('PATH', $path, $meta ));
|
||||
|
||||
$html .= '<title>' . $title . '</title>';
|
||||
$html .= '<meta name="description" content="' . $meta . '"/>';
|
||||
|
||||
foreach ($styles as $href) {
|
||||
$html .= '<link rel="stylesheet" href="' . $this->prefix_x_head_href($href) . '" class="x-head">';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
extends ./page.tpl.pug
|
||||
|
||||
block init
|
||||
- var title = `index - powered by h5ai v${pkg.version} (${pkg.homepage})`
|
||||
- var module = 'index'
|
||||
|
||||
block body
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
extends ./page.tpl.pug
|
||||
|
||||
block init
|
||||
- var title = `h5ai info page - v${pkg.version}`
|
||||
- var module = 'info'
|
||||
|
||||
block body
|
||||
|
|
|
|||
|
|
@ -7,10 +7,9 @@ html(class='no-js', lang='en')
|
|||
head
|
||||
meta(charset='utf-8')
|
||||
meta(http-equiv='x-ua-compatible', content='ie=edge')
|
||||
title #{title}
|
||||
meta(name='description', content=title)
|
||||
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||
link(rel='shortcut icon', href!='<?= $public_href; ?>images/favicon/favicon-16-32.ico')
|
||||
meta(property='og:image', content!='<?= $public_href; ?>images/favicon/favicon-152.png')
|
||||
link(rel='apple-touch-icon-precomposed', type='image/png', href!='<?= $public_href; ?>images/favicon/favicon-152.png')
|
||||
link(rel='stylesheet', href!='<?= $public_href; ?>css/styles.css')
|
||||
<?php if (!$fallback_mode) { ?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue