dragomano / Optimus

A simple SEO mod for SMF
https://custom.simplemachines.org/mods/index.php?mod=2659
Artistic License 2.0
6 stars 8 forks source link

!Fix meta tag og:image always displays #26

Closed tuivodich closed 4 years ago

tuivodich commented 4 years ago

Hello, the meta tag "og:image" always displays on the website whether we check "Use the image from the first topic message in the meta tag og:image" or not.

I think we should fix a litte bit in Sources/Optimus/Subs.php Find (line 150): if (empty($settings['og_image'])) { Replace with: if (empty($settings['og_image']) && empty($modSettings['optimus_og_image'])) {

P/S: I edited the replace value!

dragomano commented 4 years ago

og:image is a required tag, see https://www.ogp.me/ for additional info.

tuivodich commented 4 years ago

I see mate, but when we want to use first topic image on the facebook, then the og:image shouldn’t be display! That’s just a little fix. Please see in action on my fanpage: https://facebook.com/layphatvn . It’s using both first topic image and og:image website setting!

dragomano commented 4 years ago

Your fix works with Facebook, I see. But what about other services? For example, Yandex Webmaster shows an error due og:image is empty/not exist.

dragomano commented 4 years ago

I removed this block fully, see the commit

tuivodich commented 4 years ago

I removed this block fully, see the commit

Nice, but actually we still have the $modSettings['optimus_og_image'] value at the Admin CP: yourforum/index.php?action=admin;area=optimus;sa=extra, that we can chose option "Use the image from the first topic message in the meta tag og:image" or use OG Image on current theme! [defined with function extraTabSettings($return_config = false) in Sources/Optimus/Settings.php]

In my opinion, we should hold that block and change a little bit: if (empty($settings['og_image'])) { change to if (empty($settings['og_image']) && empty($modSettings['optimus_og_image'])) {