diff --git a/system/layoutUtils.php b/system/layoutUtils.php index 3f36781..81b8349 100644 --- a/system/layoutUtils.php +++ b/system/layoutUtils.php @@ -39,16 +39,23 @@ function GetProcessedPageMeta(): ProcessedPageMeta $processed = new ProcessedPageMeta(); + // We either use default full title from config.json or append the config.appended_title into the given title. $processed->title = !isset($page_meta->title) || strlen($page_meta->title) == 0 ? $config->full_title : "$page_meta->title$config->appended_title"; + + // If no desc is given, use the default desc from config.json $processed->desc = !isset($page_meta->desc) || strlen($page_meta->desc) == 0 ? $config->site_desc : $page_meta->desc; + // if an og_image is given and the link is local, get its dimensions as well if (!preg_match('/^(https?:\/\/|\/)/', $page_meta->og_image)) { list($processed->og_image_width, $processed->og_image_height) = getimagesize($page_meta->og_image); $processed->og_image = getCurrentHostnameWithProtocol() . "/" . $page_meta->og_image; - } else if (preg_match('/^https?:\/\//', $page_meta->og_image)) { + } + // If an og_image is given and the link is not local, use it as is + else if (preg_match('/^https?:\/\//', $page_meta->og_image)) { $processed->og_image = $page_meta->og_image; } + // Nothing to process with type, just copy it over $processed->type = $page_meta->type; return $processed;