✨ (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
|
@ -298,6 +298,24 @@ echo Bootstrap::formInputHidden(array(
|
||||||
'tip' => DOMAIN_CATEGORIES
|
'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(
|
echo Bootstrap::formInputText(array(
|
||||||
'name' => 'uriBlog',
|
'name' => 'uriBlog',
|
||||||
'label' => $L->g('Blog'),
|
'label' => $L->g('Blog'),
|
||||||
|
|
|
@ -105,6 +105,8 @@ class Theme
|
||||||
global $url;
|
global $url;
|
||||||
global $site;
|
global $site;
|
||||||
global $tags;
|
global $tags;
|
||||||
|
global $archives;
|
||||||
|
global $authors;
|
||||||
global $categories;
|
global $categories;
|
||||||
global $WHERE_AM_I;
|
global $WHERE_AM_I;
|
||||||
global $page;
|
global $page;
|
||||||
|
@ -131,6 +133,23 @@ class Theme
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// Category doesn't exist
|
// 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 {
|
} else {
|
||||||
$format = $site->titleFormatHomepage();
|
$format = $site->titleFormatHomepage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ class Site extends dbJSON
|
||||||
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
'titleFormatPages' => '{{page-title}} | {{site-title}}',
|
||||||
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
'titleFormatCategory' => '{{category-name}} | {{site-title}}',
|
||||||
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
'titleFormatTag' => '{{tag-name}} | {{site-title}}',
|
||||||
|
'titleFormatAuthor' => '{{author-name}} | {{site-title}}',
|
||||||
|
'titleFormatArchive' => '{{archive-name}} | {{site-title}}',
|
||||||
'imageRestrict' => true,
|
'imageRestrict' => true,
|
||||||
'imageRelativeToAbsolute' => false,
|
'imageRelativeToAbsolute' => false,
|
||||||
'thumbnailWidth' => 400, // px
|
'thumbnailWidth' => 400, // px
|
||||||
|
@ -322,6 +324,16 @@ class Site extends dbJSON
|
||||||
return $this->getField('titleFormatTag');
|
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
|
// Returns the absolute URL of the site logo
|
||||||
// If you set $absolute=false returns only the filename
|
// If you set $absolute=false returns only the filename
|
||||||
public function logo($absolute = true)
|
public function logo($absolute = true)
|
||||||
|
|
Loading…
Add table
Reference in a new issue