✨ (settings): allow to modify the author/archive URI
This commit is contained in:
parent
34fd8b57ff
commit
b9a02584dc
3 changed files with 49 additions and 0 deletions
bl-kernel
|
@ -298,6 +298,24 @@ echo Bootstrap::formInputHidden(array(
|
|||
'tip' => DOMAIN_CATEGORIES
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name' => 'uriArchive',
|
||||
'label' => $L->g('Archive'),
|
||||
'value' => $site->uriFilters('archive'),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => DOMAIN_ARCHIVES
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name' => 'uriAuthor',
|
||||
'label' => $L->g('Authors'),
|
||||
'value' => $site->uriFilters('author'),
|
||||
'class' => '',
|
||||
'placeholder' => '',
|
||||
'tip' => DOMAIN_AUTHORS
|
||||
));
|
||||
|
||||
echo Bootstrap::formInputText(array(
|
||||
'name' => 'uriBlog',
|
||||
'label' => $L->g('Blog'),
|
||||
|
|
|
@ -105,6 +105,8 @@ class Theme
|
|||
global $url;
|
||||
global $site;
|
||||
global $tags;
|
||||
global $archives;
|
||||
global $authors;
|
||||
global $categories;
|
||||
global $WHERE_AM_I;
|
||||
global $page;
|
||||
|
@ -131,6 +133,23 @@ class Theme
|
|||
} catch (Exception $e) {
|
||||
// Category doesn't exist
|
||||
}
|
||||
} elseif ($WHERE_AM_I == 'archive') {
|
||||
try {
|
||||
$archiveKey = $url->slug();
|
||||
$format = $site->titleFormatArchive();
|
||||
$format = Text::replace('{{archive-name}}', Date::prettyArchiveDate($archiveKey), $format);
|
||||
} catch (Exception $e) {
|
||||
// Archive doesn't exist
|
||||
}
|
||||
} elseif ($WHERE_AM_I == 'author') {
|
||||
try {
|
||||
$authorKey = $url->slug();
|
||||
$user = new User($authorKey);
|
||||
$format = $site->titleFormatAuthor();
|
||||
$format = Text::replace('{{author-name}}', $user->displayName(), $format);
|
||||
} catch (Exception $e) {
|
||||
// Author doesn't exist
|
||||
}
|
||||
} else {
|
||||
$format = $site->titleFormatHomepage();
|
||||
}
|
||||
|
|
|
@ -45,6 +45,8 @@ class Site extends dbJSON
|
|||
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
||||
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
||||
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
||||
'titleFormatAuthor' => '{{author-name}} | {{site-title}}',
|
||||
'titleFormatArchive' => '{{archive-name}} | {{site-title}}',
|
||||
'imageRestrict' => true,
|
||||
'imageRelativeToAbsolute' => false,
|
||||
'thumbnailWidth' => 400, // px
|
||||
|
@ -322,6 +324,16 @@ class Site extends dbJSON
|
|||
return $this->getField('titleFormatTag');
|
||||
}
|
||||
|
||||
public function titleFormatArchive()
|
||||
{
|
||||
return $this->getField('titleFormatArchive');
|
||||
}
|
||||
|
||||
public function titleFormatAuthor()
|
||||
{
|
||||
return $this->getField('titleFormatAuthor');
|
||||
}
|
||||
|
||||
// Returns the absolute URL of the site logo
|
||||
// If you set $absolute=false returns only the filename
|
||||
public function logo($absolute = true)
|
||||
|
|
Loading…
Add table
Reference in a new issue