Skip to content

Commit e78ea35

Browse files
derickrsy-records
andauthored
Update title and descriptions for manual pages (#1372)
Co-authored-by: Luffy <lufei@php.net>
1 parent 3dbf1bf commit e78ea35

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

include/header.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ if (!isset($config["languages"])) {
6565
<base href="<?php echo $_SERVER["BASE_HREF"]; ?>">
6666
<?php endif ?>
6767

68-
<title>PHP: <?php echo $title ?></title>
68+
<title><?php echo $title ?></title>
6969

7070
<?php foreach($CSS as $filename => $modified): ?>
7171
<link rel="stylesheet" type="text/css" href="/cached.php?t=<?php echo $modified?>&amp;f=<?php echo $filename?>" media="screen">

include/layout.inc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,13 @@ EOT;
421421
return $retval;
422422
}
423423

424-
function site_header(string $title = 'Hypertext Preprocessor', array $config = []): void
424+
function site_header(?string $title = NULL, array $config = []): void
425425
{
426426
global $MYSITE, $LANG;
427427

428+
$title = $title ? "PHP: {$title}" : 'PHP';
428429
$meta_image_path = $MYSITE . 'images/meta-image.png';
429-
$meta_description = "PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.";
430+
$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.";
430431

431432
$defaults = [
432433
"lang" => $LANG,
@@ -441,13 +442,13 @@ function site_header(string $title = 'Hypertext Preprocessor', array $config = [
441442
442443
<meta name="twitter:card" content="summary_large_image" />
443444
<meta name="twitter:site" content="@official_php" />
444-
<meta name="twitter:title" content="PHP: Hypertext Preprocessor" />
445+
<meta name="twitter:title" content="{$title}" />
445446
<meta name="twitter:description" content="{$meta_description}" />
446447
<meta name="twitter:creator" content="@official_php" />
447448
<meta name="twitter:image:src" content="{$meta_image_path}" />
448449
449-
<meta itemprop="name" content="PHP: Hypertext Preprocessor" />
450-
<meta itemprop="description" content="$meta_description" />
450+
<meta itemprop="name" content="{$title}" />
451+
<meta itemprop="description" content="{$meta_description}" />
451452
<meta itemprop="image" content="{$meta_image_path}" />
452453
453454
<meta property="og:image" content="{$meta_image_path}" />

include/shared-manual.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,9 @@ function manual_setup($setup): void {
325325
"prev" => $setup["prev"],
326326
"next" => $setup["next"],
327327
"cache" => $lastmod,
328+
"description" => $setup["this"][2] ?? null,
328329
];
329-
site_header($setup["this"][1] . " - Manual ", $config);
330+
site_header($setup["this"][1] . " - Manual", $config);
330331

331332
$languageChooser = manual_language_chooser($config['lang'], $config['thispage']);
332333

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
</div>
109109
EOF;
110110

111-
site_header("Hypertext Preprocessor",
111+
site_header(NULL,
112112
[
113113
'current' => 'home',
114114
'headtags' => [

0 commit comments

Comments
 (0)