Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
11 changes: 6 additions & 5 deletions include/layout.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem right. We should not use the title if there is no description given.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would you like to see instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old generic description ("PHP is a popular general-purpose scripting language that powers everything from your blog to the most popular websites in the world.") would work (or just nothing).

Comment thread
sy-records marked this conversation as resolved.
Outdated

$defaults = [
"lang" => $LANG,
Expand All @@ -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}" />
Expand Down
3 changes: 2 additions & 1 deletion include/shared-manual.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</div>
EOF;

site_header("Hypertext Preprocessor",
Comment thread
sy-records marked this conversation as resolved.
site_header(NULL,
[
'current' => 'home',
'headtags' => [
Expand Down