1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Update title and descriptions for manual pages (#1372)

Co-authored-by: Luffy <lufei@php.net>
This commit is contained in:
Derick Rethans
2025-09-03 08:27:36 +01:00
committed by GitHub
parent 3dbf1bf385
commit e78ea355df
4 changed files with 10 additions and 8 deletions

View File

@@ -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?>&amp;f=<?php echo $filename?>" media="screen">

View File

@@ -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}" />

View File

@@ -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']);

View File

@@ -108,7 +108,7 @@ $intro .= <<<EOF
</div>
EOF;
site_header("Hypertext Preprocessor",
site_header(NULL,
[
'current' => 'home',
'headtags' => [