Discussion #78: Add option for custom greeting message

This commit is contained in:
Dale Davies
2023-04-13 23:41:30 +01:00
parent 0f2045cf1e
commit ed9178bf8e
7 changed files with 13 additions and 7 deletions

View File

@@ -1 +1 @@
v1.3.2 (1681419310)
v1.3.2 (1681425251)

View File

@@ -19,7 +19,9 @@ class HomePage extends AbstractPage {
$template = $this->mustache->loadTemplate('header');
$greeting = null;
if (!$this->config->parse_bool($this->config->get('showgreeting'))) {
$greeting = $this->language->get('tags.home');
$greeting = '#'.$this->language->get('tags.home');
} else if ($this->config->get('customgreeting') !== ''){
$greeting = $this->config->get('customgreeting');
}
$csrfsection = $this->session->getSection('csrf');
$unsplashdata = $this->cache->load('unsplash');

View File

@@ -20,6 +20,7 @@ class TagPage extends AbstractPage {
protected function render_header(): string {
$template = $this->mustache->loadTemplate('header');
$this->tagname = $this->routeparams['tag'];
$greeting = '#'.$this->tagname;
$title = 'Tag: '.$this->tagname;
$csrfsection = $this->session->getSection('csrf');
$unsplashdata = $this->cache->load('unsplash');
@@ -27,7 +28,7 @@ class TagPage extends AbstractPage {
$checkstatus = $this->config->parse_bool($this->config->get('checkstatus', false));
$templatecontext = [
'csrftoken' => $csrfsection->get('token'),
'greeting' => $this->tagname,
'greeting' => $greeting,
'noindex' => $this->config->parse_bool($this->config->get('noindex')),
'title' => $title,
'owmapikey' => !!$this->config->get('owmapikey', false),

View File

@@ -39,8 +39,11 @@ return [
'showclock' => getenv('SHOWCLOCK') ?: true,
// 12 hour clock format?
'ampmclock' => getenv('AMPMCLOCK') ?: false,
// Show a friendly greeting message rather than "#home".
// Show a friendly greeting message rather than "#home", defaults to a dynamic
// greeting based on time of day. E.g Good Morning.
'showgreeting' => getenv('SHOWGREETING') ?: true,
// Custom greeting string as alternative to built-in friendy greeting.
'customgreeting' => getenv('CUSTOMGREETING') ?: '',
// Show the search bar, requires /search/searchengines.json etc.
'showsearch' => getenv('SHOWSEARCH') ?: true,
// Include the robots noindex meta tag in site header.

View File

@@ -33,7 +33,7 @@
<body>
<div class="content fixed hidden {{# checkstatus}}status{{/ checkstatus}}">
<div class="greeting">
{{# greeting}}<span class="tagname"><span>#</span>{{greeting}}</span>{{/ greeting}}
{{# greeting}}<span class="tagname"><span></span>{{greeting}}</span>{{/ greeting}}
{{^ greeting}}<span class="chosen"></span>{{/ greeting}}
</div>

View File

@@ -1 +1 @@
<script defer src="{{{wwwurl}}}/assets/js/index.fd2874ea51dbd2dad294.min.js"></script>
<script defer src="{{{wwwurl}}}/assets/js/index.f2468ba60142a7aa8d24.min.js"></script>