WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] og:image set to default image but article/page has own images (11 posts)

  1. msebald
    Member
    Posted 11 months ago #

    I just noticed that the og:image meta data is set to the default image also for articles/pages which have own images.

    Interesting because the plugin Wordbooker does detect the images.

    Example URL (with both Opengraph outputs active):
    http://dev.pro-taucher.de/tauchplaetze/afrika/aegypten/strasse-von-gubal/carnatic/

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. jrf
    Member
    Posted 11 months ago #

    Are the images added via a shortcode ?

  3. msebald
    Member
    Posted 11 months ago #

    Yes, you're right. I add these images through the page template and use a NextGen Gallery fuction to display these.

    But why does Wordbooker get those images and WordPress SEO does not?

  4. jrf
    Member
    Posted 11 months ago #

    Wordbooker uses a different method for retrieving the post content and searching for images.

    Anyways, I think it makes sense to search for images only after resolving the shortcodes, so I've send in a pull request on GitHub which makes this change. Fingers crossed it makes it into the next release.

    Even so, if you add a do_shortcode('[gallery_shortcode]'); straight into a template of your (child-)theme, this fix will still not work.

    Hope this helps!

    Smile,
    Juliette

  5. msebald
    Member
    Posted 11 months ago #

    Sounds promising! Thank you! :-)

    I get the images Wordbooker is retrieving from a function:

    function NggRandom($galleryId = 0) {
    $randompictures = nggdb::get_random_images(5, $galleryId);
    $randompictures_output = "";
    foreach ($randompictures as $randompictures_value) {
    $randompictures_output = $randompictures_output.'<img src="'.$randompictures_value->thumbURL.'" height="80" alt="'.$randompictures_value->alttext.'" title="'.$randompictures_value->alttext.'"/>';
    }
    return $randompictures_output;
    }

    I "echo" the function with a gallery id before the_content() in the template I use for the dive sites listed on the website.

  6. jrf
    Member
    Posted 11 months ago #

    Ok, thanks for that extra information. This basically means that WP SEO - at this moment - can't retrieve the images as they are not in any way available in a variable before the control is handed over to the template.

    There are of course ways around that, but the overhead you'd cause to the server - and more importantly: the significantly slower page load time - using those methods is not justifiable.

  7. msebald
    Member
    Posted 11 months ago #

    Interesting. So Wordbooker is using an alternative method which results in a very slow page load?

  8. jrf
    Member
    Posted 11 months ago #

    Wordbooker is using an alternative method, though it is a different one than what I am/was thinking of.

    The thing is that you can't account for all possible situations. Wordbooker doesn't either. From a quick glance at their code, I gather they look -amongst other things- at everything with the attachment post type linked to the specific post.
    In your case, I can then only presume that the NextGen Gallery is adding the images to the database table as attachments.

    However there are lots of different ways the data about images could be stored and lots of different plugins doing it their own way (no matter how wrong sometimes). Similarly, you are adding the images to the page via a function in the template, you are not using a shortcode or a content filter to add the images. Again, so many ways to do it, so many ways in which images could be added to a page...

    The only sure-fire way to get all the images - independently of how they are added to the page - is to actually request the page and scrape it. In effect, this would mean loading the page twice to only present it to the user once.... Not very efficient or user-friendly - which is why I referred to the server overhead and page load time.

    So basically the question is: how far do you go to get the images for a page ? Just looking at the content (and featured image if set) is a very lean way, scraping the complete page is the most bloated way.
    Every plugin strikes their own balance in that regards and WP SEO and Wordbooker have made different choices for now.

    Does this make it a bit clearer ?

  9. msebald
    Member
    Posted 11 months ago #

    Yes, thank you very much for this detailed information. I was just technically interested why it works for one plugin and why not for another. Plus it sounded like the way Wordbooker does it makes the page load much slower as it needs to be. In my eyes a fast page is more important than og:image tags, which are used, but not used very often. So I would rate the speed over these tags.

    Also on my site I use a special way to get the content onto the complete rendered webpage in the browser. Which has nothing to do with the standard way most WordPress do it with filling the content area of a page/article in the WP backend. So for sure WP SEO works in most of the cases just fine.

    Thanks again for explaining this.

    And maybe in the future there will be changes in WP SEO which allow also getting "my" images. But I can wait on this. ;-)

  10. jrf
    Member
    Posted 11 months ago #

    Glad to be of help. Could you mark this topic as resolved ?

  11. msebald
    Member
    Posted 11 months ago #

    Yes. I just marked it.

Reply

You must log in to post.

About this Plugin

About this Topic