Add meta.php for dynamic meta tag generation

- Introduced meta.php to handle meta tags dynamically based on the presence of values in the $ometa array.
- Set default values for meta tags using predefined variables if $ometa values are not set.
- Included essential meta tags for SEO and social media sharing, including Open Graph and Twitter cards.
- Ensured compatibility with various devices by adding viewport and charset meta tags.
This commit is contained in:
Gary 2025-05-08 16:09:16 +01:00
parent 4e4cd28ba8
commit a3d3016846
18 changed files with 257 additions and 1 deletions

View File

@ -13,7 +13,7 @@ include_once $URlsorrection . "includes/banner.php";
<section class="ftco-section ftco-no-pt ftco-no-pb bg-light">
<div class="container">
<div class="row d-flex no-gutters">
<div class="col-md-6 d-flex">
<div class="col-md-6 d-flex padding-top-10">
<div class="img img-video d-flex align-self-stretch align-items-center justify-content-center mb-4 mb-sm-0" style="background-image:url(images/project.jpg);">
</div>
</div>

View File

@ -1,3 +1,9 @@
<?php
?>
<!DOCTYPE html>
<html lang="en">
<head>

4
includes/htaccess Normal file
View File

@ -0,0 +1,4 @@
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

View File

@ -1,6 +1,8 @@
<?php
$URLcorrection = "";
$PageTitle = "Home";
$PageDescription = "Trusted roofing specialists in the UK, Warmseal Roofing offers expert roof repairs, installations, and maintenance with quality workmanship and guaranteed results.";
include_once $URLcorrection . "includes/header.php";

51
meta/config.php Normal file
View File

@ -0,0 +1,51 @@
<?php
//PAGE VARIABLES GLOBALS USER OVERIDES TO REPLACE DEFAULTS
$metatitle = "Warmseal Roofing - $PageTitle";
$metadescription = "Trusted roofing specialists in the UK, Warmseal Roofing offers expert roof repairs, installations, and maintenance with quality workmanship and guaranteed results.";
$metakeywords = "roofing, roof repairs, roof installation, roofing specialists, roofing maintenance, quality workmanship, guaranteed results, UK roofing, Warmseal Roofing";
$metarobots = "index, follow";
$metalanguage = "en";
$metarevisit = "7 days";
$metaauthor = "Warmseal Roofing";
$metaappleicon = "$URLcorrection/meta/favicons/apple-touch-icon.png";
$metaicon32 = "$URLcorrection/meta/favicons/favicon-32x32.png";
$metaicon16 = "$URLcorrection/meta/favicons/favicon-16x16.png";
$metamanifest = "$URLcorrection/meta/favicons/site.webmanifest";
$metaogtype = "website";
$metaogurl = "https://warmseal-roofing.co.uk";
$metaogtitle = "Warmseal Roofing - $PageTitle";
$metaogdescription = "Trusted roofing specialists in the UK, Warmseal Roofing offers expert roof repairs, installations, and maintenance with quality workmanship and guaranteed results.";
$metaogimage = "$URLcorrection/meta/favicons/android-chrome-512x512.png";
$metatwitterurl = "https://warmseal-roofing.co.uk";
$metatwittercard = "summary_large_image";
$metatwittertitle = "Warmseal Roofing - $PageTitle";
$metatwitterdescription = "Trusted roofing specialists in the UK, Warmseal Roofing offers expert roof repairs, installations, and maintenance with quality workmanship and guaranteed results.";
$metatwitterimage = "$URLcorrection/media/favicons/android-chrome-512x512.png";
//overide code example:
// $ometa['title'] = "Acorn Media - $PageTitle";
// $ometa['description'] = "Acorn Media: Your hub for business web hosting, website design, and digital media services, including advertising and social media management.";
// $ometa['keywords'] = "business hosting, web design, digital services, advertising solutions, social media management, online presence, marketing strategies, media solutions, domain registration, domain, hosting, logo design, branding";
// $ometa['robots'] = "index, follow";
// $ometa['language'] = "English";
// $ometa['revisit-after'] = "7 days";
// $ometa['author'] = "Acorn Media";
// $ometa['apple-touch-icon'] = "$URLcorrection/media/favicons/apple-touch-icon.png";
// $ometa['icon32'] = "$URLcorrection/media/favicons/favicon-32x32.png";
// $ometa['icon16'] = "$URLcorrection/media/favicons/favicon-16x16.png";
// $ometa['site.webmanifest'] = "$URLcorrection/media/favicons/site.webmanifest";
// $ometa['ogtype'] = "website";
// $ometa['ogurl'] = "https://acorn-media.co.uk/";
// $ometa['ogtitle'] = "Acorn Media - $PageTitle";
// $ometa['ogdescription'] = "Acorn Media: Your hub for business web hosting, website design, and digital media services, including advertising and social media management.";
// $ometa['ogimage'] = "$URLcorrection/media/favicons/android-chrome-512x512.png";
// $ometa['twittercard'] = "summary_large_image";
// $ometa['twittertitle'] = "Acorn Media - $PageTitle";
// $ometa['twitterdescription'] = "Acorn Media: Your hub for business web hosting, website design, and digital media services, including advertising and social media management.";
// $ometa['twitterimage'] = "$URLcorrection/media/favicons/android-chrome-512x512.png";

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/meta/favicons/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
meta/favicons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="668.000000pt" height="668.000000pt" viewBox="0 0 668.000000 668.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,668.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M5382 6666 c-370 -71 -672 -294 -937 -691 -105 -157 -221 -370 -415
-760 -199 -400 -328 -682 -531 -1160 -82 -192 -155 -361 -162 -375 -12 -23
-18 -25 -82 -24 -39 0 -142 8 -230 17 -343 37 -694 47 -935 27 -63 -5 -152
-12 -197 -16 l-83 -7 0 912 0 911 -205 0 -205 0 0 -954 0 -954 -62 -22 c-535
-196 -902 -691 -1047 -1409 -82 -402 -91 -754 -31 -1090 121 -667 554 -1072
1145 -1071 338 1 604 116 883 384 247 238 432 503 582 834 58 129 292 732 575
1487 87 231 164 426 171 434 11 13 72 5 441 -57 235 -40 473 -76 528 -82 289
-30 1039 -22 1428 15 127 12 155 18 193 40 104 61 143 210 85 323 -47 93 -128
117 -301 92 -348 -50 -1012 -61 -1375 -22 -115 12 -264 32 -330 43 -66 12
-204 36 -307 53 -103 18 -190 35 -193 38 -12 12 72 192 453 975 465 954 516
1055 581 1153 126 187 284 331 466 423 173 87 338 98 481 33 153 -70 228 -220
227 -456 -1 -172 -39 -376 -121 -645 -53 -174 -57 -233 -22 -312 23 -55 82
-117 126 -133 64 -25 143 -2 220 64 51 44 62 69 130 311 122 435 141 543 131
729 -17 296 -157 608 -341 757 -80 65 -210 132 -322 164 -111 33 -298 42 -412
21z m-2752 -3406 c257 -12 499 -35 513 -49 16 -16 -652 -1738 -749 -1932 -118
-238 -285 -455 -454 -592 -171 -138 -315 -197 -501 -205 -224 -9 -392 49 -523
182 -83 84 -127 154 -174 279 -90 239 -101 458 -46 907 51 414 171 726 378
987 72 90 203 207 278 248 l48 26 0 -970 0 -971 205 0 205 0 0 1034 c0 817 3
1036 13 1043 35 22 450 28 807 13z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

BIN
meta/media/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

151
meta/meta.php Normal file
View File

@ -0,0 +1,151 @@
<?php
$Ometa = array();
$meta = array();
include_once $URLcorrection . "meta/config.php";
if (isset($ometa['title'])) {
$meta['title'] = $ometa['title'];
} else {
$meta['title'] = $metatitle;
}
if (isset($ometa['description'])) {
$meta['description'] = $ometa['description'];
} else {
$meta['description'] = $metadescription;
}
if (isset($ometa['keywords'])) {
$meta['keywords'] = $ometa['keywords'];
} else {
$meta['keywords'] = $metakeywords;
}
if (isset($ometa['robots'])) {
$meta['robots'] = $ometa['robots'];
} else {
$meta['robots'] = $metarobots;
}
if (isset($ometa['language'])) {
$meta['language'] = $ometa['language'];
} else {
$meta['language'] = $metalanguage;
}
if (isset($ometa['revisit-after'])) {
$meta['revisit-after'] = $ometa['revisit-after'];
} else {
$meta['revisit-after'] = $metarevisit;
}
if (isset($ometa['author'])) {
$meta['author'] = $ometa['author'];
} else {
$meta['author'] = $metaauthor;
}
if (isset($ometa['apple-touch-icon'])) {
$meta['apple-touch-icon'] = $ometa['apple-touch-icon'];
} else {
$meta['apple-touch-icon'] = $metaappleicon;
}
if (isset($ometa['icon32'])) {
$meta['icon32'] = $ometa['icon32'];
} else {
$meta['icon32'] = $metaicon32;
}
if (isset($ometa['icon16'])) {
$meta['icon16'] = $ometa['icon16'];
} else {
$meta['icon16'] = $metaicon16;
}
if (isset($ometa['site.webmanifest'])) {
$meta['site.webmanifest'] = $ometa['site.webmanifest'];
} else {
$meta['site.webmanifest'] = $metamanifest;
}
if (isset($ometa['ogtype'])) {
$meta['ogtype'] = $ometa['ogtype'];
} else {
$meta['ogtype'] = $metaogtype;
}
if (isset($ometa['ogurl'])) {
$meta['ogurl'] = $ometa['ogurl'];
} else {
$meta['ogurl'] = $metaogurl;
}
if (isset($ometa['ogtitle'])) {
$meta['ogtitle'] = $ometa['ogtitle'];
} else {
$meta['ogtitle'] = $metaogtitle;
}
if (isset($ometa['ogdescription'])) {
$meta['ogdescription'] = $ometa['ogdescription'];
} else {
$meta['ogdescription'] = $metaogdescription;
}
if (isset($ometa['ogimage'])) {
$meta['ogimage'] = $ometa['ogimage'];
} else {
$meta['ogimage'] = $metaogimage;
}
if (isset($ometa['twittercard'])) {
$meta['twittercard'] = $ometa['twittercard'];
} else {
$meta['twittercard'] = $metatwittercard;
}
if (isset($ometa['twitterurl'])) {
$meta['twitterurl'] = $ometa['twitterurl'];
} else {
$meta['twitterurl'] = $metatwitterurl;
}
if (isset($ometa['twittertitle'])) {
$meta['twittertitle'] = $ometa['twittertitle'];
} else {
$meta['twittertitle'] = $metatwittertitle;
}
if (isset($ometa['twitterdescription'])) {
$meta['twitterdescription'] = $ometa['twitterdescription'];
} else {
$meta['twitterdescription'] = $metatwitterdescription;
}
if (isset($ometa['twitterimage'])) {
$meta['twitterimage'] = $ometa['twitterimage'];
} else {
$meta['twitterimage'] = $metatwitterimage;
}
?>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?=$meta['title']?></title>
<meta name="title" content="<?=$meta['title']?>">
<meta name="description" content="<?=$meta['description']?>">
<meta name="keywords" content="<?=$meta['keywords']?>">
<meta name="robots" content="<?=$meta['robots']?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="language" content="<?=$meta['language']?>">
<meta name="revisit-after" content="<?=$meta['revisit-after']?>">
<meta name="author" content="<?=$meta['author']?>">
<link rel="apple-touch-icon" sizes="180x180" href="<?=$meta['apple-touch-icon']?>">
<link rel="icon" type="image/png" sizes="32x32" href="<?=$meta['icon32']?>">
<link rel="icon" type="image/png" sizes="16x16" href="<?=$meta['icon16']?>">
<!--<link rel="manifest" href="--><?php //=$meta['manifest']?><!--">-->
<link rel="mask-icon" href="/meta/favicons/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/meta/favicons/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/meta/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="<?=$meta['ogtype']?>" />
<meta property="og:url" content="<?=$meta['ogurl']?>" />
<meta property="og:title" content="<?=$meta['ogtitle']?>" />
<meta property="og:description" content="<?=$meta['ogdescription']?>"/>
<meta property="og:image" content="<?=$meta['ogimage']?>" />
<!-- Twitter -->
<meta property="twitter:card" content="<?=$meta['twittercard'] ?>" />
<meta property="twitter:url" content="<?=$meta['twitterurl'] ?>" />
<meta property="twitter:title" content="<?=$meta['twittertitle'] ?>" />
<meta property="twitter:description" content="<?=$meta['twitterdescription'] ?>" />
<meta property="twitter:image" content="<?=$meta['twitterimage'] ?>" />