allow setting of open graph image in blog posts

This commit is contained in:
Jeremy Kauffman 2019-10-01 13:05:21 -04:00
parent f039ddf660
commit ed8fec9c4d
3 changed files with 11 additions and 5 deletions

View file

@ -3,6 +3,7 @@ author: jeremy-kauffman
title: 'Hacktoberfest 2019!' title: 'Hacktoberfest 2019!'
date: '2019-10-01 11:37:00' date: '2019-10-01 11:37:00'
cover: 'Hacktoberfest.jpg' cover: 'Hacktoberfest.jpg'
og: 'https://spee.ch/@lbryblog:e/hacktoberfest2019.png'
category: developers category: developers
--- ---
@ -44,12 +45,14 @@ Note: the chat link goes to LBRYs main public chat. Post a message in binary*
Anyone who makes any contribution at all, even a one line typo fix, will receive a LBRY sticker. Anyone who makes any contribution at all, even a one line typo fix, will receive a LBRY sticker.
Anyone who contributes anything of any substance* will receive a LBRY T-Shirt. Anyone who contributes anything of any substance* will receive a sticker, LBRY t-shirt, and more.
As always, anyone who contributes will receive LBC as [appreciation](https://lbry.com/faq/appreciation). And as always, anyone who contributes will receive LBC as [appreciation](https://lbry.com/faq/appreciation).
Additionally, this month only, every contributor, new or returning, will receive a 10,000 LBC bonus for their first PR of this month. Additionally, this month only, every contributor, new or returning, will receive a 10,000 LBC bonus for their first PR of this month.
T-shirts and stickers will be the above Hacktoberfest image.
*Were going to be very inclusive as counting PRs as substantive, but due to some people making drive-by PRs to earn shirts, weve introduced this additional qualifier. *Were going to be very inclusive as counting PRs as substantive, but due to some people making drive-by PRs to earn shirts, weve introduced this additional qualifier.
## <a name="events"></a>Events ## <a name="events"></a>Events

View file

@ -309,6 +309,11 @@ class Post
{ {
$urls = []; $urls = [];
$metadata = $this->getMetadata();
if (isset($metadata['og']) && $metadata['og']) {
$urls[] = $metadata['og'];
}
$cover = $this->getCover(); $cover = $this->getCover();
if ($cover) { if ($cover) {
$urls[] = 'https://' . Request::getHost() . '/img/blog-covers/' . $cover; $urls[] = 'https://' . Request::getHost() . '/img/blog-covers/' . $cover;
@ -321,7 +326,7 @@ class Post
$urls = array_merge($urls, $matches[1]); $urls = array_merge($urls, $matches[1]);
} }
return $urls; return array_unique($urls);
} }
protected function markdownToText($markdown) protected function markdownToText($markdown)

View file

@ -43,8 +43,6 @@
<meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/> <meta property="og:description" content="<?php echo Response::getMetaDescription() ?>"/>
<?php foreach ($images as $image): ?> <?php foreach ($images as $image): ?>
<meta property="og:image" content="<?php echo $image ?>"/> <meta property="og:image" content="<?php echo $image ?>"/>
<meta property="og:image:height" content="1125"/>
<meta property="og:image:width" content="2000"/>
<?php endforeach ?> <?php endforeach ?>
<meta property="og:site_name" content="LBRY"/> <meta property="og:site_name" content="LBRY"/>
<meta property="og:title" content="<?php echo $title ?>"/> <meta property="og:title" content="<?php echo $title ?>"/>