mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
better handling of channel meta
This commit is contained in:
parent
df18f57217
commit
a2a7a22c38
4 changed files with 10 additions and 10 deletions
|
@ -136,14 +136,15 @@ class Channel extends Controller {
|
|||
|
||||
Libprofile::load($which,$profile);
|
||||
|
||||
App::$page['htmlhead'] .= '<meta property="og:title" content="' . htmlspecialchars($channel['channel_name']) . '">' . "\r\n";
|
||||
App::$page['htmlhead'] .= '<meta property="og:image" content="' . $channel['xchan_photo_l'] . '">' . "\r\n";
|
||||
|
||||
App::$meta->set('og:title', $channel['channel_name']);
|
||||
App::$meta->set('og:image', $channel['xchan_photo_l']);
|
||||
App::$meta->set('og:type','webpage');
|
||||
App::$meta->set('og:url', channel_url($channel));
|
||||
if(App::$profile['about'] && perm_is_allowed($channel['channel_id'],get_observer_hash(),'view_profile')) {
|
||||
App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(App::$profile['about']) . '">' . "\r\n";
|
||||
App::$meta->set('og:description', App::$profile['about']);
|
||||
}
|
||||
else {
|
||||
App::$page['htmlhead'] .= '<meta property="og:description" content="' . htmlspecialchars(sprintf( t('This is the home page of %s.'), $channel['channel_name'])) . '">' . "\r\n";
|
||||
App::$meta->set('og:description', sprintf( t('This is the home page of %s.'), $channel['channel_name']));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,12 @@ class HttpMeta {
|
|||
$o = '';
|
||||
if($this->vars) {
|
||||
foreach($this->vars as $k => $v) {
|
||||
$o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ;
|
||||
$o .= '<meta property="' . htmlspecialchars($k,ENT_COMPAT,'UTF-8',false) . '" content="' . htmlspecialchars($v,ENT_COMPAT,'UTF-8',false) . '" />' . "\r\n" ;
|
||||
}
|
||||
}
|
||||
if($this->check_required()) {
|
||||
foreach($this->og as $k => $v) {
|
||||
$o .= '<meta property="' . $k . '" content="' . urlencode($v) . '" />' . "\r\n" ;
|
||||
$o .= '<meta property="' . htmlspecialchars($k,ENT_COMPAT,'UTF-8',false) . '" content="' . htmlspecialchars($v,ENT_COMPAT,'UTF-8',false) . '" />' . "\r\n" ;
|
||||
}
|
||||
}
|
||||
if($o)
|
||||
|
|
4
boot.php
4
boot.php
|
@ -773,6 +773,8 @@ class App {
|
|||
public static $force_max_items = 0;
|
||||
public static $theme_thread_allow = true;
|
||||
|
||||
public static $meta;
|
||||
|
||||
/**
|
||||
* @brief An array for all theme-controllable parameters
|
||||
*
|
||||
|
@ -818,8 +820,6 @@ class App {
|
|||
|
||||
private static $baseurl;
|
||||
|
||||
private static $meta;
|
||||
|
||||
/**
|
||||
* App constructor.
|
||||
*/
|
||||
|
|
|
@ -844,7 +844,6 @@ function head_get_links() {
|
|||
return $str;
|
||||
}
|
||||
|
||||
|
||||
function format_css_if_exists($source) {
|
||||
|
||||
// script_path() returns https://yoursite.tld
|
||||
|
|
Loading…
Reference in a new issue