Browse Source

Update functions.php

pull/700/head
danpros 1 year ago
parent
commit
c26c33095e
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      system/includes/functions.php

+ 11
- 4
system/includes/functions.php View File

@ -572,7 +572,7 @@ function get_pages($pages, $page = 1, $perpage = 0)
$auto = config('toc.automatic'); $auto = config('toc.automatic');
$counter = config('views.counter'); $counter = config('views.counter');
if ($counter == 'true') { if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
@ -648,10 +648,10 @@ function get_subpages($sub_pages, $page = 1, $perpage = 0)
} }
$tmp = array(); $tmp = array();
$auto = config('toc.automatic'); $auto = config('toc.automatic');
$counter = config('views.counter'); $counter = config('views.counter');
if ($counter == 'true') { if ($counter == 'true') {
$viewsFile = "content/data/views.json"; $viewsFile = "content/data/views.json";
if (file_exists($viewsFile)) { if (file_exists($viewsFile)) {
@ -3777,6 +3777,7 @@ function generate_meta($type = null, $object = null)
if (empty($defaultImg)) { if (empty($defaultImg)) {
$defaultImg = site_url() . 'system/resources/images/logo-big.png'; $defaultImg = site_url() . 'system/resources/images/logo-big.png';
} }
$fbApp = config('fb.appid');
$facebook = config('social.facebook'); $facebook = config('social.facebook');
$twitter = config('social.twitter'); $twitter = config('social.twitter');
if (is_null($object)) { if (is_null($object)) {
@ -3796,6 +3797,9 @@ function generate_meta($type = null, $object = null)
$twitter = parse_url($twitter); $twitter = parse_url($twitter);
$tags .= '<meta name="twitter:site" content="'. str_replace('/', '@', $twitter['path']) .'" />' . "\n"; $tags .= '<meta name="twitter:site" content="'. str_replace('/', '@', $twitter['path']) .'" />' . "\n";
} }
if (!empty($fbApp)) {
$tags .= '<meta property="fb:app_id" content="'. $fbApp .'" />' . "\n";
}
} else { } else {
if(!empty($object->image)) { if(!empty($object->image)) {
$image = $object->image; $image = $object->image;
@ -3820,7 +3824,7 @@ function generate_meta($type = null, $object = null)
$tags .= '<meta name="article:modified_time" content="'. date('c', $object->lastMod) .'" />' . "\n"; $tags .= '<meta name="article:modified_time" content="'. date('c', $object->lastMod) .'" />' . "\n";
} }
if(!empty($facebook)) { if(!empty($facebook)) {
$tags .= ' <meta property="article:publisher" content="'. $facebook .'" />' . "\n";
$tags .= '<meta property="article:publisher" content="'. $facebook .'" />' . "\n";
} }
if(!empty($twitter)) { if(!empty($twitter)) {
$twitter = parse_url($twitter); $twitter = parse_url($twitter);
@ -3831,6 +3835,9 @@ function generate_meta($type = null, $object = null)
$tags .= '<meta property="og:description" content="'. $object->description .'" />' . "\n"; $tags .= '<meta property="og:description" content="'. $object->description .'" />' . "\n";
$tags .= '<meta name="twitter:card" content="summary_large_image" />' . "\n"; $tags .= '<meta name="twitter:card" content="summary_large_image" />' . "\n";
$tags .= '<meta property="og:image" content="'. $image .'" />' . "\n"; $tags .= '<meta property="og:image" content="'. $image .'" />' . "\n";
if (!empty($fbApp)) {
$tags .= '<meta property="fb:app_id" content="'. $fbApp .'" />' . "\n";
}
} }
return $tags; return $tags;


Loading…
Cancel
Save