add optional base postfix to the page title

This commit is contained in:
yggverse 2024-04-18 13:24:38 +03:00
parent f874583740
commit 8944bd2792
2 changed files with 21 additions and 0 deletions

View File

@ -33,6 +33,10 @@
"ellipsize":
{
"mode":3
},
"postfix":
{
"hostname":true
}
},
"redirect":

View File

@ -834,6 +834,23 @@ class Page
?string $value = null
): void
{
// Append hostname postfix
if ($this->config->title->postfix->hostname && str_starts_with($this->request->get_text(), 'gemini://'))
{
$address = new \Yggverse\Net\Address(
$this->request->get_text()
);
if ($address->getHost())
{
$value = sprintf(
'%s - %s',
$value,
$address->getHost()
);
}
}
// Build new tab label on title length reached
if ($value && mb_strlen($value) > $this->config->title->width->chars)
{