diff --git a/config.json b/config.json index e9ab079..91ddb14 100644 --- a/config.json +++ b/config.json @@ -10,5 +10,6 @@ "linkedin_url": "https://www.linkedin.com/in/atasasmaz", "twitter_url": "https://twitter.com/AtaSasmaz", "github_url": "https://github.com/atas", - "location": "City, Country" + "location": "City, Country", + "default_opengraph_image": "assets/images/site-icon-big.jpg" } \ No newline at end of file diff --git a/layout/header.php b/layout/header.php index 8c1006e..80e7132 100644 --- a/layout/header.php +++ b/layout/header.php @@ -6,6 +6,14 @@ $title = !isset($page_meta->title) || strlen($page_meta->title) == 0 ? $config->full_title : "$page_meta->title$config->appended_title"; $desc = !isset($page_meta->desc) || strlen($page_meta->desc) == 0 ? $config->site_desc : $page_meta->desc; +if (!preg_match('/^(https?:\/\/|\/)/', $page_meta->og_image)) { + list($og_image_width, $og_image_height) = getimagesize($page_meta->og_image); + $og_image = getCurrentHostnameWithProtocol() . "/" . $page_meta->og_image; +} +else if (preg_match('/^https?:\/\//', $page_meta->og_image)) { + $og_image = $page_meta->og_image; +} + ?> @@ -25,9 +33,14 @@ - - - + \n"; + if (isset($og_image_width)) + echo "\n"; + if (isset($og_image_height)) + echo "\n"; + ?>