com web/php: Add support for <link hreflang> as suggested by Joost de Valk <joost@yoast.com>: include/header.inc include/shared-manual.inc
| From: | Hannes Magnusson | Date: | Tue, 03 Jun 2014 22:39:13 +0000 |
| Subject: | com web/php: Add support for <link hreflang> as suggested by Joost de Valk <joost@yoast.com>: include/header.inc include/shared-manual.inc | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-19173@lists.php.net to get a copy of this message | ||
Commit: cb20874745b7df5f1b47a1b86b9980783c2cd57e
Author: Hannes Magnusson <bjori@mongodb.com> Tue, 3 Jun 2014 15:39:13 -0700
Parents: 7ce285d2202a9b58c303c744e1b618e97c48cbe6
Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=cb20874745b7df5f1b47a1b86b9980783c2cd57e
Log:
Add support for <link hreflang> as suggested by Joost de Valk <joost@yoast.com>
Changed paths:
M include/header.inc
M include/shared-manual.inc
Diff:
diff --git a/include/header.inc b/include/header.inc
index 46da10b..d3e014d 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -31,6 +31,9 @@ if ($config["cache"]) {
}
header("Last-Modified: " . $tsstring);
}
+if (!isset($config["languages"])) {
+ $config["languages"] = array();
+}
?>
<!DOCTYPE html>
@@ -51,6 +54,7 @@ if ($config["cache"]) {
<link rel="canonical" href="http://php.net/<?php echo
$_SERVER['BASE_PAGE']?>">
<?php if ($shortname): ?>
<link rel="shorturl" href="<?php echo $shorturl ?>">
+ <link rel="alternate" href="<?php echo $shorturl ?>"
hreflang="x-default">
<?php endif ?>
<?php endif ?>
@@ -58,6 +62,10 @@ if ($config["cache"]) {
<link rel="<?php echo $rel ?>" href="<?php echo $MYSITE ?><?php
echo $page ?>">
<?php endforeach ?>
+<?php foreach($config["languages"] as $code): ?>
+ <link rel="alternate" href="<?php echo $MYSITE ?>/manual/<?php echo
$code?>/<?php echo $config["thispage"] ?>" hreflang="<?php echo
$code?>">
+<?php endforeach ?>
+
<?php foreach($CSS as $filename => $modified): ?>
<link rel="stylesheet" type="text/css" href="<?php echo $MYSITE
?>cached.php?t=<?php echo $modified?>&f=<?php echo $filename?>"
media="screen">
<?php endforeach ?>
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 8fc2c08..a7e281b 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -368,6 +368,7 @@ function manual_navigation_related(array $setup) {
// including HTTP header information
function manual_setup($setup) {
global $PGI, $MYSITE, $USERNOTES;
+ global $ACTIVE_ONLINE_LANGUAGES;
//TODO: get rid of this hack to get the related items into manual_footer
global $__RELATED;
@@ -404,6 +405,7 @@ function manual_setup($setup) {
$config = array(
"current" => "docs",
"breadcrumbs" => $breadcrumbs,
+ "languages" => array_keys($ACTIVE_ONLINE_LANGUAGES),
"meta-navigation" => array(
"contents" => $base . $setup["home"][0],
"index" => $base . $setup["up"][0],