From 4cf1d83d32f1f7470788802492c880893f96101b Mon Sep 17 00:00:00 2001 From: Sergey Panteleev Date: Sat, 6 Jul 2024 16:04:44 +0300 Subject: [PATCH] OG meta tags by default (#1027) Fix #981 --- include/layout.inc | 22 ++++++++++++++++++++++ index.php | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/include/layout.inc b/include/layout.inc index c7064ecb8..df947f455 100644 --- a/include/layout.inc +++ b/include/layout.inc @@ -424,6 +424,9 @@ function site_header(string $title = 'Hypertext Preprocessor', array $config = [ { global $MYSITE; + $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."; + $defaults = [ "lang" => myphpnet_language(), "current" => "", @@ -432,6 +435,25 @@ function site_header(string $title = 'Hypertext Preprocessor', array $config = [ 'layout_span' => 9, "cache" => false, "headsup" => "", + 'meta_tags' => << + + + + + + + + + + + + + + + + +META ]; $config = array_merge($defaults, $config); diff --git a/index.php b/index.php index 9e889f788..3e2f74ef0 100644 --- a/index.php +++ b/index.php @@ -118,10 +118,6 @@ $intro .= << EOF; -// Write out common header -$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."; - site_header("Hypertext Preprocessor", [ 'current' => 'home', @@ -149,25 +145,6 @@ site_header("Hypertext Preprocessor", ], 'css' => ['home.css'], 'intro' => $intro, - 'meta_tags' => << - - - - - - - - - - - - - - - - -META ], );