prefix="og: http://ogp.me/ns#"> <?php echo get_safe_html_doctitle(); ?> .top-bar-logo, .top-bar-logo img { height: ' . CHV\getSetting('theme_logo_height') . 'px; } .top-bar-logo { margin-top: -' . (CHV\getSetting('theme_logo_height') / 2) . 'px; } '; } $open_graph = [ 'type' => 'website', 'url' => CHV\get_current_url(true, ['lang']), 'title' => G\safe_html(CHV\getSetting('website_doctitle')), 'image' => CHV\getSetting('homepage_cover_images')[0]['url'], 'site_name' => get_safe_html_website_name(), 'description' => get_safe_html_meta_description(), ]; if (CHV\getSetting('facebook_app_id')) { $open_graph['fb:app_id'] = CHV\getSetting('facebook_app_id'); } switch (true) { case function_exists('get_image') and G\is_route('image'): $open_graph_extend = [ 'type' => 'article', 'title' => get_pre_doctitle(), // 'description' => get_image()['description'], 'image' => get_image()['url'], 'image:width' => get_image()['width'], 'image:height' => get_image()['height'], ]; if (get_image()['is_animated'] && get_image()['size'] < G\get_bytes('8 MiB')) { $open_graph_extend['type'] = 'video.other'; $open_graph_extend['url'] = get_image()['url']; } break; case function_exists('get_album') and G\is_route('album'): $open_graph_extend = [ 'type' => 'article', 'title' => get_pre_doctitle(), // 'description' => get_album()['description'] ?: get_album()['name'], ]; if (in_array(get_album()['privacy'], ['public', 'private_but_link']) && get_list()->output_count) { $open_graph_extend = array_merge($open_graph_extend, [ 'image' => get_list()->output_assoc[0]['display_url'], 'image:width' => get_list()->output_assoc[0]['display_width'], 'image:height' => get_list()->output_assoc[0]['display_height'], 'image:height' => get_album()['height'], ]); } break; case function_exists('get_user') and G\is_route('user'): $open_graph_extend = [ 'type' => 'profile', 'title' => get_user()['name'], // 'description' => sprintf(is_user_images() ? _s("%s's Images") : _s("%s's Albums"), get_user()["name_short"]), 'image' => get_user()['avatar']['url'], ]; break; case function_exists('get_album') and G\is_route('album'): $open_graph_extend = [ 'title' => get_album()['name'], // 'description' => get_album()['description'], ]; break; } if ($open_graph_extend) { $open_graph = array_merge($open_graph, $open_graph_extend); } foreach ($open_graph as $k => $v) { if (!$v) { continue; } $prop = strpos($k, ':') !== false ? $k : "og:$k"; echo '' . "\n"; } // Set twitter card $twitter_card = [ 'card' => 'summary', 'description' => function_exists('get_safe_html_meta_description') ? get_safe_html_meta_description() : null, 'title' => G\str_replace_last(' - ' . get_safe_html_website_name(), null, get_safe_html_doctitle()), 'site' => CHV\getSetting('twitter_account') ? ('@' . CHV\getSetting('twitter_account')) : null, ]; switch (true) { case G\is_route('image'): $twitter_card['card'] = 'photo'; break; case function_exists('get_admin') and G\is_route('album'): case function_exists('get_user') and G\is_route('user'): $twitter_card['card'] = 'gallery'; if (G\is_route('album')) { $twitter_card['creator'] = get_album()['user']['twitter']['username']; } else { $twitter_card['creator'] = get_user()['twitter']['username']; } $list_output = function_exists('get_list') ? get_list()->output_assoc : null; if (is_array($list_output) && count($list_output) > 0) { for ($i = 0; $i < 4; ++$i) { $twitter_card['image' . $i] = $list_output[$i]['display_url']; } } break; } foreach ($twitter_card as $k => $v) { if (!$v) { continue; } echo '' . "\n"; } if (function_exists('get_image') and G\is_route('image')) { ?> $v) { echo '' . "\n"; } G\Render\include_theme_file('custom_hooks/head'); ?>