f84bcaec01
I wanted to ensure that all pages (even the downtime page, terms page, home page, etc) had the appropriate `data-` attributes on `<body>` (because those are required for certain javascript, eg autocomplete, to work). One thing led to another and now everything in `head` is microhtml'ed
36 lines
1 KiB
PHP
36 lines
1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Shimmie2;
|
|
|
|
use function MicroHTML\{META};
|
|
|
|
class SiteDescription extends Extension
|
|
{
|
|
public function onPageRequest(PageRequestEvent $event): void
|
|
{
|
|
global $config, $page;
|
|
if (!empty($config->get_string("site_description"))) {
|
|
$description = $config->get_string("site_description");
|
|
$page->add_html_header(META([
|
|
'name' => 'description',
|
|
'content' => $description
|
|
]));
|
|
}
|
|
if (!empty($config->get_string("site_keywords"))) {
|
|
$keywords = $config->get_string("site_keywords");
|
|
$page->add_html_header(META([
|
|
'name' => 'keywords',
|
|
'content' => $keywords
|
|
]));
|
|
}
|
|
}
|
|
|
|
public function onSetupBuilding(SetupBuildingEvent $event): void
|
|
{
|
|
$sb = $event->panel->create_new_block("Site Description");
|
|
$sb->add_text_option("site_description", "Description: ");
|
|
$sb->add_text_option("site_keywords", "<br>Keywords: ");
|
|
}
|
|
}
|