1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Reviewed #2393, Removed image guessing and added testing

For review of meta tag additions as per PR #2393.
This commit removes any image guesswork and only uses images that have
been set by the author for the specific content.
This also adds tests to cover the expected OG tags.
This commit is contained in:
Dan Brown
2021-06-23 20:42:48 +01:00
parent 58fa7679bc
commit 265f5db03f
7 changed files with 110 additions and 39 deletions

View File

@ -138,23 +138,4 @@ class Page extends BookChild
$refreshed->html = (new PageContent($refreshed))->render();
return $refreshed;
}
/**
* Returns URL to a cover image for the page.
*/
public function getCoverImage()
{
//$default = $this->book->getBookCover();
$default = url('/logo.png');
$firstImage = (new PageContent($this))->fetchFirstImage();
try {
$cover = $firstImage ? $firstImage : $default;
} catch (\Exception $err) {
$cover = $default;
}
return $cover;
}
}