Skip to content

Commit

Permalink
Merge pull request #46 from Dave-Clark-Design-Associates/dcda_main
Browse files Browse the repository at this point in the history
Bugfix: Fall back Default image wasn't being loaded.
  • Loading branch information
samthejarvis authored Aug 30, 2022
2 parents e11c9b5 + 918650e commit 0b7c401
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
todo

.sass-cache
.sass-cache
.idea
.vscode/settings.json
7 changes: 6 additions & 1 deletion src/Model/Extension/SeoPageControllerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,17 @@ public function getPageMetaTags()
return DBField::create_field('HTMLText', $meta);
}

/**
* Gets the Defaut Page Social Image, this is defined in the CMS
*
* @return null|Image
*/
public function getDefaultPageSocialImage()
{
$siteConfig = SiteConfig::get()->first();

if ($siteConfig) {
$image = Image::get()->byID($siteConfig->DefaultPageSocialImageID);
$image = Image::get()->byID($siteConfig->DefaultSocialImageID);

if ($image) {
return $image;
Expand Down
1 change: 1 addition & 0 deletions templates/HeadTags.ss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<meta name="twitter:image" content="$PageSocialImage.AbsoluteURL">
<% else_if $DefaultPageSocialImage %>
<meta property="og:image" content="$DefaultPageSocialImage.AbsoluteURL">
<meta name="twitter:image" content="$DefaultPageSocialImage.AbsoluteURL">
<% end_if %>

<% if $SiteFacebookAppID %>
Expand Down

0 comments on commit 0b7c401

Please sign in to comment.