From 3dfeed6f0658f9cd1fedc8846d1d91c678fd1110 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 28 Aug 2025 18:54:51 +0100 Subject: [PATCH 1/3] Update title and descriptions for manual pages This makes use of the new information that Phd will display once https://github.com/php/phd/pull/201 is merged. It changes the title on the home page also to just "PHP" (removing the `: Hypertext Preprocessor` part). It also changes the meta information for manual pages, which is used for social media cards. --- include/header.inc | 2 +- include/layout.inc | 11 ++++++----- include/shared-manual.inc | 1 + index.php | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/header.inc b/include/header.inc index 3da277344c..f3889daf7f 100644 --- a/include/header.inc +++ b/include/header.inc @@ -65,7 +65,7 @@ if (!isset($config["languages"])) { "> - PHP: <?php echo $title ?> + <?php echo $title ?> $modified): ?> diff --git a/include/layout.inc b/include/layout.inc index c69d390b32..f359462dca 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -421,12 +421,13 @@ EOT; return $retval; } -function site_header(string $title = 'Hypertext Preprocessor', array $config = []): void +function site_header(?string $title = NULL, array $config = []): void { global $MYSITE, $LANG; + $title = $title ? "PHP: {$title}" : 'PHP'; $meta_image_path = $MYSITE . 'images/meta-image.png'; - $meta_description = "PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world."; + $meta_description = $config['description'] ?? $title; $defaults = [ "lang" => $LANG, @@ -441,13 +442,13 @@ function site_header(string $title = 'Hypertext Preprocessor', array $config = [ - + - - + + diff --git a/include/shared-manual.inc b/include/shared-manual.inc index eb0437e278..da121ff3ed 100644 --- a/include/shared-manual.inc +++ b/include/shared-manual.inc @@ -325,6 +325,7 @@ function manual_setup($setup): void { "prev" => $setup["prev"], "next" => $setup["next"], "cache" => $lastmod, + "description" => $setup["this"][2] ?? null, ]; site_header($setup["this"][1] . " - Manual ", $config); diff --git a/index.php b/index.php index 5e52b8a57c..9808189f79 100644 --- a/index.php +++ b/index.php @@ -108,7 +108,7 @@ EOF; -site_header("Hypertext Preprocessor", +site_header(NULL, [ 'current' => 'home', 'headtags' => [ From 5a4ce72abdf84e4a1afa0a447d2e236b5be8dd3c Mon Sep 17 00:00:00 2001 From: Luffy Date: Mon, 1 Sep 2025 11:30:30 +0100 Subject: [PATCH 2/3] Remove superfluous space --- include/shared-manual.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/shared-manual.inc b/include/shared-manual.inc index da121ff3ed..5d10ea5df0 100644 --- a/include/shared-manual.inc +++ b/include/shared-manual.inc @@ -327,7 +327,7 @@ function manual_setup($setup): void { "cache" => $lastmod, "description" => $setup["this"][2] ?? null, ]; - site_header($setup["this"][1] . " - Manual ", $config); + site_header($setup["this"][1] . " - Manual", $config); $languageChooser = manual_language_chooser($config['lang'], $config['thispage']); From 2ceb89655f20ae4bd5eab290972738f7b530138a Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 2 Sep 2025 16:36:46 +0100 Subject: [PATCH 3/3] Revert back to original description, if no specific one was set --- include/layout.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/layout.inc b/include/layout.inc index f359462dca..83efa1c6bb 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -427,7 +427,7 @@ function site_header(?string $title = NULL, array $config = []): void $title = $title ? "PHP: {$title}" : 'PHP'; $meta_image_path = $MYSITE . 'images/meta-image.png'; - $meta_description = $config['description'] ?? $title; + $meta_description = $config['description'] ?? "PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world."; $defaults = [ "lang" => $LANG,