OG на странице точки
This commit is contained in:
parent
b4e186f958
commit
f8272672d6
|
|
@ -31,4 +31,17 @@ class Helper
|
|||
|
||||
return $string;
|
||||
}
|
||||
|
||||
public static function buildOG($point)
|
||||
{
|
||||
$og = array();
|
||||
$og['title'] = $point->name . ' [wikipoints.ru]';
|
||||
$og['description'] = mb_substr($point->description, 0, 200).'...';
|
||||
$og['site_name'] = 'WikiPoints: Лучшие выходные - это выходные в путешествии!';
|
||||
$og['type'] = 'article';
|
||||
$og['url'] = 'http://wikipoints.ru/?point=' . $point->id;
|
||||
$og['image'] = $point->getImg();
|
||||
|
||||
return $og;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ class IndexController extends Controller
|
|||
App::setConfig('title', $res['pointsCount'] . ' или даже больше поводов не сидеть дома');
|
||||
self::addVar('pointsCount', $res['pointsCount']);
|
||||
|
||||
$og = array();
|
||||
if (isset($_GET['point']) && $_GET['point'] && is_numeric($_GET['point']))
|
||||
{
|
||||
$id = (int) $_GET['point'];
|
||||
|
|
@ -75,14 +74,10 @@ class IndexController extends Controller
|
|||
$point->descriptionHtml .= ' Посмотреть на карте: http://wikipoints.ru/?point=' . $id;
|
||||
$point->descriptionHtml .= ' #wikipoints';
|
||||
|
||||
$og['title'] = $point->name . ' [wikipoints.ru]';
|
||||
$og['description'] = $point->descriptionHtml;
|
||||
$og['site_name'] = 'WikiPoints - ' . $res['pointsCount'] . ' или даже больше поводов не сидеть дома';
|
||||
$og['type'] = 'article';
|
||||
$og['url'] = 'http://wikipoints.ru/?point=' . $id;
|
||||
$og['image'] = $point->getImg();
|
||||
$og = Helper::buildOG($point);
|
||||
} else if (isset($_GET['point']) && $_GET['point'] && strtolower($_GET['point']) == 'random')
|
||||
{
|
||||
$og = array();
|
||||
$og['title'] = 'Случайная точка на wikipoints.ru';
|
||||
$og['description'] = 'Загляните сюда: http://vk.com/wikipoints Случайная точка на карте - лучший способ узнать что-то новое!';
|
||||
$og['site_name'] = 'WikiPoints - ' . $res['pointsCount'] . ' или даже больше поводов не сидеть дома';
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ class PageController extends Controller
|
|||
'photos' => $point->photos,
|
||||
'countInFavs' => Favorite::model()->countInFavs($pointId),
|
||||
'countLikes' => Like::model()->countLikes($pointId),
|
||||
'og' => Helper::buildOG($point),
|
||||
));
|
||||
} else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<div class="glyphicon glyphicon-globe _t boxButtonLayers" onclick="openBox('Layers')" title="Слои карты"></div>
|
||||
<div class="glyphicon glyphicon-filter _c boxButtonFilter" title="Фильтры и поиск" onclick="openBox('Filter')"></div>
|
||||
<div class="glyphicon glyphicon-flag _b" title="Я на карте" onclick="showMeOnTheMap()"></div>
|
||||
<div class="glyphicon glyphicon-screenshot _b" title="Я на карте" onclick="showMeOnTheMap()"></div>
|
||||
<div class="glyphicon glyphicon-list boxButtonRoute" title="Маршрут" onclick="openBox('Route')"></div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
lang="ru"
|
||||
prefix="og: http://ogp.me/ns#"
|
||||
xmlns:fb="http://ogp.me/ns/fb#"
|
||||
xmlns:og="http://ogp.me/ns#">
|
||||
<head>
|
||||
<title><?= App::getConfig('title') ?></title>
|
||||
|
||||
|
|
@ -22,6 +26,16 @@
|
|||
<?php endforeach; ?>
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($data['og']): ?>
|
||||
<meta property="og:title" content="<?= $data['og']['title'] ?>" />
|
||||
<meta property="og:description" content="<?= $data['og']['description'] ?>" />
|
||||
<meta property="og:site_name" content="<?= $data['og']['site_name'] ?>" />
|
||||
<meta property="og:type" content="<?= $data['og']['type'] ?>" />
|
||||
<meta property="og:url" content="<?= $data['og']['url'] ?>" />
|
||||
<meta property="og:image" content="<?= $data['og']['image'] ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Ubuntu:400&subset=Cyrillic">
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue