Author: Derick Rethans (derickr) Committer: GitHub (web-flow) Pusher: sy-records Date: 2025-09-03T15:27:36+08:00
Commit: https://github.com/php/web-php/commit/e78ea355df3f3ed040bbd36f6a120e44f0f1037d Raw diff: https://github.com/php/web-php/commit/e78ea355df3f3ed040bbd36f6a120e44f0f1037d.diff Update title and descriptions for manual pages (#1372) Co-authored-by: Luffy <[email protected]> Changed paths: M include/header.inc M include/layout.inc M include/shared-manual.inc M index.php Diff: 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"])) { <base href="<?php echo $_SERVER["BASE_HREF"]; ?>"> <?php endif ?> - <title>PHP: <?php echo $title ?></title> + <title><?php echo $title ?></title> <?php foreach($CSS as $filename => $modified): ?> <link rel="stylesheet" type="text/css" href="/cached.php?t=<?php echo $modified?>&f=<?php echo $filename?>" media="screen"> diff --git a/include/layout.inc b/include/layout.inc index c69d390b32..83efa1c6bb 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'] ?? "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, @@ -441,13 +442,13 @@ function site_header(string $title = 'Hypertext Preprocessor', array $config = [ <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@official_php" /> -<meta name="twitter:title" content="PHP: Hypertext Preprocessor" /> +<meta name="twitter:title" content="{$title}" /> <meta name="twitter:description" content="{$meta_description}" /> <meta name="twitter:creator" content="@official_php" /> <meta name="twitter:image:src" content="{$meta_image_path}" /> -<meta itemprop="name" content="PHP: Hypertext Preprocessor" /> -<meta itemprop="description" content="$meta_description" /> +<meta itemprop="name" content="{$title}" /> +<meta itemprop="description" content="{$meta_description}" /> <meta itemprop="image" content="{$meta_image_path}" /> <meta property="og:image" content="{$meta_image_path}" /> diff --git a/include/shared-manual.inc b/include/shared-manual.inc index eb0437e278..5d10ea5df0 100644 --- a/include/shared-manual.inc +++ b/include/shared-manual.inc @@ -325,8 +325,9 @@ 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); + site_header($setup["this"][1] . " - Manual", $config); $languageChooser = manual_language_chooser($config['lang'], $config['thispage']); diff --git a/index.php b/index.php index 5e52b8a57c..9808189f79 100644 --- a/index.php +++ b/index.php @@ -108,7 +108,7 @@ </div> EOF; -site_header("Hypertext Preprocessor", +site_header(NULL, [ 'current' => 'home', 'headtags' => [
