Skip to content

Commit

Permalink
comments in layoutUtils.php
Browse files Browse the repository at this point in the history
  • Loading branch information
atas committed Oct 15, 2023
1 parent 3552673 commit db5f175
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion system/layoutUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit db5f175

Please sign in to comment.