SEO test
This commit is contained in:
35
lib/page.php
35
lib/page.php
@@ -157,12 +157,47 @@ function getPage($site_name_in = null, $page_name_in = null): string
|
||||
|
||||
$navigation = generateNavigation();
|
||||
|
||||
$seo = array();
|
||||
|
||||
|
||||
if(!empty($pageMetadata["parameters"]["author"])){
|
||||
$seo["author"] = htmlspecialchars($pageMetadata["parameters"]["author"]);
|
||||
}
|
||||
else{
|
||||
$seo["author"] = $routerConfig["seo"]["author"];
|
||||
}
|
||||
|
||||
if(!empty($pageMetadata["parameters"]["description"])){
|
||||
$seo["description"] = htmlspecialchars($pageMetadata["parameters"]["description"]);
|
||||
}
|
||||
else{
|
||||
$seo["description"] = $routerConfig["seo"]["description"];
|
||||
}
|
||||
|
||||
if(!empty($pageMetadata["parameters"]["keywords"])){
|
||||
$seo["keywords"] = $routerConfig["seo"]["keywords"] . ", " . htmlspecialchars($pageMetadata["parameters"]["keywords"]);
|
||||
}
|
||||
else{
|
||||
$seo["keywords"] = $routerConfig["seo"]["keywords"];
|
||||
}
|
||||
|
||||
$seo["generator"] = $routerConfig["seo"]["generator"];
|
||||
|
||||
$seo["robots"] = $routerConfig["seo"]["robots"];
|
||||
|
||||
$seo_stuff = "";
|
||||
|
||||
foreach ($seo as $key => $value){
|
||||
$seo_stuff .= "<meta name='$key' content='$value'>\n";
|
||||
}
|
||||
|
||||
$out = $skeleton;
|
||||
$out = str_replace("__TEMPLATE__NAV__", $navigation, $out);
|
||||
$out = str_replace("__TEMPLATE__PAGE__", $page, $out);
|
||||
$out = str_replace("__TEMPLATE__FOOTER__", $footer, $out);
|
||||
$out = str_replace("__TEMPLATE__DYNAMIC__SCRIPT__", $dynamic_script, $out);
|
||||
$out = str_replace("__TEMPLATE__DYNAMIC__STYLE__", $dynamic_style, $out);
|
||||
$out = str_replace("__TEMPLATE_SEO_STUFF__", $seo_stuff, $out);
|
||||
if($routerConfig["inlining"]) {
|
||||
require_once "lib/inliner.php";
|
||||
$out = inlineLocalStylesFromHref($out);
|
||||
|
Reference in New Issue
Block a user