Add descriptions

Fixes #88
This commit is contained in:
Kazhnuz 2025-07-13 19:19:21 +02:00
parent f6feca8b6d
commit eeaee2baae
3 changed files with 68 additions and 2 deletions

View file

@ -108,6 +108,7 @@ class Theme
global $categories;
global $WHERE_AM_I;
global $page;
global $L;
if ($WHERE_AM_I == 'page') {
return $page->title();
@ -142,6 +143,60 @@ class Theme
} catch (Exception $e) {
// Author doesn't exist
}
} elseif ($WHERE_AM_I == 'home') {
return $L->get("Latest articles");
}
return null;
}
public static function locationDescription()
{
global $url;
global $site;
global $tags;
global $archives;
global $authors;
global $categories;
global $WHERE_AM_I;
global $page;
global $L;
if ($WHERE_AM_I == 'page') {
return $page->description();
} elseif ($WHERE_AM_I == 'tag') {
try {
$tagKey = $url->slug();
$tag = new Tag($tagKey);
return $L->get('all-post-tags') . " \"" . $tag->name() . "\"";
} catch (Exception $e) {
// Tag doesn't exist
}
} elseif ($WHERE_AM_I == 'category') {
try {
$categoryKey = $url->slug();
$category = new Category($categoryKey);
return $category->description();
} catch (Exception $e) {
// Category doesn't exist
}
} elseif ($WHERE_AM_I == 'archive') {
try {
$archiveKey = $url->slug();
return $L->get('all-post-archive') . Date::prettyArchiveDate($archiveKey);
} catch (Exception $e) {
// Archive doesn't exist
}
} elseif ($WHERE_AM_I == 'author') {
try {
$authorKey = $url->slug();
$user = new User($authorKey);
return $L->get('all-post-author') . $user->displayName();
} catch (Exception $e) {
// Author doesn't exist
}
} elseif ($WHERE_AM_I == 'home') {
return $L->get("all-post");
}
return null;

View file

@ -415,5 +415,11 @@
"insert-thumbnail": "Insert thumbnail",
"insert-linked-thumbnail": "Insert linked thumbnail",
"more-infos": "More infos",
"base-infos": "Base infos"
"base-infos": "Base infos",
"latest-articles": "Latest articles",
"all-post-tags": "All posts with the tag",
"all-post-archive": "All posts written in",
"all-post-author": "All posts written by",
"all-post": "All the latest posts written on the blog"
}

View file

@ -426,5 +426,10 @@
"base-infos": "Infos de bases",
"source-link": "Lien source",
"the-external-link-you-refer-to-in-the-post":"Le lien externe auquel vous vous referrez dans le contenu",
"powered-by":"Propulsé par"
"powered-by":"Propulsé par",
"latest-articles": "Derniers articles",
"all-post-tags": "Tous les articles avec le tag",
"all-post-archive": "Tous les articles écrits en",
"all-post-author": "Tous les articles écrits par",
"all-post": "Tout les articles écrits récemment sur le blog"
}