From a4002017b091968878d7b387fa901200593196d2 Mon Sep 17 00:00:00 2001 From: "E. S." Date: Thu, 14 Mar 2024 23:48:30 +0000 Subject: [PATCH] meta updates --- engine/skin.php | 2 ++ handler/FilesHandler.php | 4 ++++ handler/MainHandler.php | 8 ++++++++ strings/main.yaml | 3 +++ 4 files changed, 17 insertions(+) diff --git a/engine/skin.php b/engine/skin.php index 149d85e..47f02d5 100644 --- a/engine/skin.php +++ b/engine/skin.php @@ -115,6 +115,8 @@ function add_meta(array $data) { } }; foreach ($data as $key => $value) { + if (str_starts_with($value, '$')) + $value = lang(substr($value, 1)); switch ($key) { case '$url': case '$title': diff --git a/handler/FilesHandler.php b/handler/FilesHandler.php index d9f8899..79763b4 100644 --- a/handler/FilesHandler.php +++ b/handler/FilesHandler.php @@ -8,6 +8,10 @@ class FilesHandler extends request_handler { const SEARCH_MIN_QUERY_LENGTH = 3; function GET_files() { + add_meta([ + '$title' => '$meta_files_title', + '$description' => '$meta_files_description' + ]); set_title('$files'); set_skin_opts(['head_section' => 'files']); $collections = array_map(fn(FilesCollection $c) => new CollectionItem($c), FilesCollection::cases()); diff --git a/handler/MainHandler.php b/handler/MainHandler.php index 78af66c..7d66e8e 100644 --- a/handler/MainHandler.php +++ b/handler/MainHandler.php @@ -21,6 +21,8 @@ class MainHandler extends request_handler { function GET_contacts() { redirect('/info/'); } function GET_page() { + global $config; + list($name) = input('name'); $page = pages::getByName($name); @@ -39,6 +41,12 @@ class MainHandler extends request_handler { if ($page->shortName == 'info') set_skin_opts(['head_section' => 'about']); + if ($page) { + add_meta([ + '$url' => 'https://'.$config['domain'].$page->getUrl(), + '$title' => $page->title, + ]); + } set_title($page ? $page->title : '???'); render('main/page', unsafe_html: $page->getHtml(is_retina(), getUserTheme()), diff --git a/strings/main.yaml b/strings/main.yaml index 125d790..f2768fd 100644 --- a/strings/main.yaml +++ b/strings/main.yaml @@ -24,6 +24,9 @@ lang_ru: "Русский" meta_index_title: "4in1. Mask of Shakespeare, mysteries of Bacon, book by Cartier, secrets of the NSA" meta_index_description: "This is the official web site of the book \"4in1\"." +meta_files_title: "4in1 - Files" +meta_files_description: "Large archive of files and documents that provide the evidentiary basis for the \"4in1\" investigation." + # blog blog_new_post: "New post" blog_view_post: "View post"