Skip to content

Commit

Permalink
fix for image error + blueprint default error
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmassen committed Mar 18, 2018
1 parent 769e300 commit a42469e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blueprints/seo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ form:
type: toggle
label: PLUGIN_SEO.FACEBOOK_ENABLE
id: facebookenable
default: plugins.seo.facebook_default
config-default@: plugins.seo.facebook_default
highlight: 1
options:
1: PLUGIN_ADMIN.YES
Expand Down
11 changes: 8 additions & 3 deletions seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ public function onPageInitialized()
} else {
$meta['twitter:image']['name'] = 'twitter:image';
$meta['twitter:image']['property'] = 'twitter:image';
$firstimage = array_shift($page->media()->images())->url();
$imgobject = $page->media()->images();
$getfirst = array_shift($imgobject);
$firstimage = $getfirst->url();
//$imagedata = $this->seoGetimage($firstimage);
$meta['twitter:image']['content'] = $this->grav['uri']->base() . $firstimage;
};
Expand Down Expand Up @@ -294,8 +296,11 @@ public function onPageInitialized()
$meta['og:image']['content'] = $this->grav['uri']->base() . $imagedata['url'];
} else {
$meta['og:image']['property'] = 'og:image';
$firstimage = array_shift($page->media()->images());
$firstimage = $firstimage->url();
$imgobject = $page->media()->images();
$getfirst = array_shift($imgobject);
$firstimage = $getfirst->url();
//$imagedata = $this->seoGetimage($firstimage);
$meta['twitter:image']['content'] = $this->grav['uri']->base() . $firstimage;
$meta['og:image']['content'] = $this->grav['uri']->base() . $firstimage;
}

Expand Down

3 comments on commit a42469e

@sergixnet
Copy link

@sergixnet sergixnet commented on a42469e Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated now Seo plugin and my site crashes, this is the error:

error-pluginseo

Maybe it has to do with this last change. I am using v2.3.1 test release of the plugin

Grav v1.4.1 - Admin v1.7.1

Please I need help, what can I do to solve this?

Thanks

@paulmassen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens when no media is on the page and is now fixed in latest release

You can download it here https://github.com/paulmassen/grav-plugin-seo/archive/master.zip

and install it via drag and drop.

Please tell me if it works.
Thanks

@sergixnet
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! it works

Please sign in to comment.