Country[Not specified] shows on facebook, on a "like" of a posting 2.5 BE.net?

Topics: ASP.NET 2.0, Business Logic Layer, Controls
Oct 10, 2011 at 8:57 PM

I cant figure out where this is coming from.. but it seems no matter what facebook like plugin/extension i use i end up with this below the "person likes a link" on facebook:

Country [Not specified]AfghanistanAlbaniaAlgeriaArgentinaArmeniaAustraliaAustriaAzerbaijanBahrainBangladeshBelarusBelgiumBelizeBermudaBolivarian Republic of VenezuelaBoliviaBosnia and HerzegovinaBrazilBrunei DarussalamBulgariaCambodiaCanadaCaribbeanChileColombiaCosta RicaCroatiaCzech Republi...

Does anyone know where this is coming from and how to fix?

 

Thanks

Oct 12, 2011 at 7:29 AM

You need to check your Facebook LIKE button code. It is pointing to a wrong URL to be liked.

Generally, the LIKE button code points to the web address of the page on which it has ben placed. This makes sure that when user clicks the LIKE button, the correct URL is shared on Facebook.

It looks like this URL is pointing to some wrong location.

Let me know if you need more information.

Oct 12, 2011 at 5:40 PM
anil21_22gupta wrote:

You need to check your Facebook LIKE button code. It is pointing to a wrong URL to be liked.

Generally, the LIKE button code points to the web address of the page on which it has ben placed. This makes sure that when user clicks the LIKE button, the correct URL is shared on Facebook.

It looks like this URL is pointing to some wrong location.

Let me know if you need more information.

 

This happens with ANY facebook like extension unfortunately.

For instance, the addThis one does it as well.

 

I've narrowed this down to the SQL server side of things, well, so i thought.. though if i do the xml version, the same issue persists, so maybe not.

I ran the install steps as directed in the instructions.. added the code to web.config etc.. ran the .sql query to update and create all tables.

If it truely is some sort of c# coding issue in any of these fb addons, any suggestions on what to look for?

 

 

Thanks

Oct 12, 2011 at 5:49 PM

I don;t think BlogEngine has Facebook LIKE code in itself. You must have added an extension.

If that is the case, you need to go to

App_Code->extensions

and then check the code for Facebook of Addthis extension. The pointer to your Blog URL would be wrong somewhere in this code.

If you are not sure, let me know the name/link of extension and i will try to see the code. Or if it is possible, copy and paste the code here itself.

Oct 12, 2011 at 7:23 PM
anil21_22gupta wrote:

I don;t think BlogEngine has Facebook LIKE code in itself. You must have added an extension.

If that is the case, you need to go to

App_Code->extensions

and then check the code for Facebook of Addthis extension. The pointer to your Blog URL would be wrong somewhere in this code.

If you are not sure, let me know the name/link of extension and i will try to see the code. Or if it is possible, copy and paste the code here itself.

Well, the facebook like extension code is shorter, so ill try pasting it here.. i cant imagine that their code is wrong though, noone else out there seems to be reporting this, but either way i have tried everything, nothing works with these "facebook" extensions.. i've tried them on my home machine and a work IIS server and on the hosting server all with the same country code weirdness:

 

 

facebook like:

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BlogEngine.Core;
using BlogEngine.Core.Web.Controls;
using BlogEngine.Core.Web.Extensions;
using System.Text;

/// <summary>
/// Summary description for FacebookLike
/// </summary>
[Extension("Helps in like your Post with Facebook", "1.0", "<a href=\"http://www.isharpnote.com/\">ISHARPNOTE</a>",800)]
public class FacebookLike
{

    static protected ExtensionSettings _extensionSettings;
    private const string ExtensionName = "FacebookLike";
    public FacebookLike()
    {
        InitializeSettings();
        Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving);
    }

    void Post_Serving(object sender, ServingEventArgs e)
    {
        if (e.Location == ServingLocation.Feed) return;

        bool ShowPostList = Convert.ToBoolean(_extensionSettings.GetSingleValue("ShowPostList"));
        if (e.Location == ServingLocation.PostList && !ShowPostList) return;

        Post post = sender as Post;
        ButtonSettings bSettings = new ButtonSettings();
        StringBuilder sBuild = new StringBuilder();
        sBuild.AppendLine("<div class=\"FacebookLike\">");
        string likeScript = string.Format("<iframe src=\"http://www.facebook.com/plugins/like.php?href={0}&amp;layout={1}&amp;show_faces={2}&amp;width={3}&amp;action={4}&amp;font&amp;colorscheme={5}&amp;height=80\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:80px;\" allowTransparency=\"true\"></iframe>",
            post.AbsoluteLink.AbsoluteUri, bSettings.Layout, bSettings.ShowFaces, bSettings.Width, bSettings.Action, bSettings.ColorScheme);
        sBuild.AppendLine(likeScript);
        sBuild.AppendLine("</div>");
        e.Body += sBuild.ToString();
    }

    private void InitializeSettings()
    {
        var settings = new ExtensionSettings(ExtensionName);
        settings.Help = "Enable facebook Like button on Post Home page and Post page";

        settings.IsScalar = true;
        settings.AddParameter("ShowPostList", "Display Like button on featured list", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("ShowFaces", "Show Faces (Show profile pictures below the button)", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("Width", "Width (the width of the plugin in pixel)", 20, false, false, ParameterType.String);
        settings.AddParameter("Action", "Verb to display", 20, false, false, ParameterType.DropDown);
        settings.AddValue("Action", new string [] { "like", "recommend" }, "like");
        settings.AddParameter("ColorScheme", "Color Scheme (color scheme of the plugin)", 20, false, false, ParameterType.DropDown);
        settings.AddValue("ColorScheme", new string[] { "light", "dark" }, "light");
        settings.AddParameter("SelectedLayout", "Layout Style", 20, false, false, ParameterType.DropDown);
        settings.AddValue("SelectedLayout", new string[] { "standard", "button_count", "box_count" }, "standard");
        settings.AddValue("ShowPostList", true);
        _extensionSettings = ExtensionManager.InitSettings(ExtensionName, settings);
    }


    class ButtonSettings
    {
        public string Layout { get; set; }
        public string ShowFaces { get; set; }
        public string Width { get; set; }
        public string Action { get; set; }
        public string ColorScheme { get; set; }

        public ButtonSettings()
        {
            this.Layout = _extensionSettings.GetSingleValue("SelectedLayout") ?? "standard";
            this.ShowFaces = _extensionSettings.GetSingleValue("ShowFaces") ?? "false";
            this.Width = _extensionSettings.GetSingleValue("Width") ?? "450";
            this.Action = _extensionSettings.GetSingleValue("Action") ?? "like";
            this.ColorScheme = _extensionSettings.GetSingleValue("ColorScheme") ?? "light";
        }
    }
}

Oct 12, 2011 at 8:01 PM

Copy and paste the following modified code and see if it works:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BlogEngine.Core;
using BlogEngine.Core.Web.Controls;
using BlogEngine.Core.Web.Extensions;
using System.Text;

/// <summary>
/// Summary description for FacebookLike
/// </summary>
[Extension("Helps in like your Post with Facebook", "1.0", "<a href=\"http://www.isharpnote.com/\">ISHARPNOTE</a>",800)]
public class FacebookLike
{

    static protected ExtensionSettings _extensionSettings;
    private const string ExtensionName = "FacebookLike";
    public FacebookLike()
    {
        InitializeSettings();
        Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving);
    }

    void Post_Serving(object sender, ServingEventArgs e)
    {
        if (e.Location == ServingLocation.Feed) return;

        bool ShowPostList = Convert.ToBoolean(_extensionSettings.GetSingleValue("ShowPostList"));
        if (e.Location == ServingLocation.PostList && !ShowPostList) return;

        Post post = sender as Post;
        ButtonSettings bSettings = new ButtonSettings();
        StringBuilder sBuild = new StringBuilder();
        sBuild.AppendLine("<div class=\"FacebookLike\">");
        string likeScript = string.Format("<iframe src=\"http://www.facebook.com/plugins/like.php?href={0}&amp;layout={1}&amp;show_faces={2}&amp;width={3}&amp;action={4}&amp;font&amp;colorscheme={5}&amp;height=80&amp;appId=126328004123602\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:80px;\" allowTransparency=\"true\"></iframe>",
            post.AbsoluteLink.AbsoluteUri, bSettings.Layout, bSettings.ShowFaces, bSettings.Width, bSettings.Action, bSettings.ColorScheme);
        sBuild.AppendLine(likeScript);
        sBuild.AppendLine("</div>");
        e.Body += sBuild.ToString();
    }

    private void InitializeSettings()
    {
        var settings = new ExtensionSettings(ExtensionName);
        settings.Help = "Enable facebook Like button on Post Home page and Post page";

        settings.IsScalar = true;
        settings.AddParameter("ShowPostList", "Display Like button on featured list", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("ShowFaces", "Show Faces (Show profile pictures below the button)", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("Width", "Width (the width of the plugin in pixel)", 20, false, false, ParameterType.String);
        settings.AddParameter("Action", "Verb to display", 20, false, false, ParameterType.DropDown);
        settings.AddValue("Action", new string [] { "like", "recommend" }, "like");
        settings.AddParameter("ColorScheme", "Color Scheme (color scheme of the plugin)", 20, false, false, ParameterType.DropDown);
        settings.AddValue("ColorScheme", new string[] { "light", "dark" }, "light");
        settings.AddParameter("SelectedLayout", "Layout Style", 20, false, false, ParameterType.DropDown);
        settings.AddValue("SelectedLayout", new string[] { "standard", "button_count", "box_count" }, "standard");
        settings.AddValue("ShowPostList", true);
        _extensionSettings = ExtensionManager.InitSettings(ExtensionName, settings);
    }


    class ButtonSettings
    {
        public string Layout { get; set; }
        public string ShowFaces { get; set; }
        public string Width { get; set; }
        public string Action { get; set; }
        public string ColorScheme { get; set; }

        public ButtonSettings()
        {
            this.Layout = _extensionSettings.GetSingleValue("SelectedLayout") ?? "standard";
            this.ShowFaces = _extensionSettings.GetSingleValue("ShowFaces") ?? "false";
            this.Width = _extensionSettings.GetSingleValue("Width") ?? "450";
            this.Action = _extensionSettings.GetSingleValue("Action") ?? "like";
            this.ColorScheme = _extensionSettings.GetSingleValue("ColorScheme") ?? "light";
        }
    }
}

The overall code looks good. I have a small change as per the Facebook Like button code from facebook site. If this also does not work, please share your blog web address and i will see what could be the issue.
Oct 12, 2011 at 8:11 PM

anil21_22gupta wrote:

Copy and paste the following modified code and see if it works:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BlogEngine.Core;
using BlogEngine.Core.Web.Controls;
using BlogEngine.Core.Web.Extensions;
using System.Text;

/// <summary>
/// Summary description for FacebookLike
/// </summary>
[Extension("Helps in like your Post with Facebook", "1.0", "<a href=\"http://www.isharpnote.com/\">ISHARPNOTE</a>",800)]
public class FacebookLike
{

    static protected ExtensionSettings _extensionSettings;
    private const string ExtensionName = "FacebookLike";
    public FacebookLike()
    {
        InitializeSettings();
        Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving);
    }

    void Post_Serving(object sender, ServingEventArgs e)
    {
        if (e.Location == ServingLocation.Feed) return;

        bool ShowPostList = Convert.ToBoolean(_extensionSettings.GetSingleValue("ShowPostList"));
        if (e.Location == ServingLocation.PostList && !ShowPostList) return;

        Post post = sender as Post;
        ButtonSettings bSettings = new ButtonSettings();
        StringBuilder sBuild = new StringBuilder();
        sBuild.AppendLine("<div class=\"FacebookLike\">");
        string likeScript = string.Format("<iframe src=\"http://www.facebook.com/plugins/like.php?href={0}&amp;layout={1}&amp;show_faces={2}&amp;width={3}&amp;action={4}&amp;font&amp;colorscheme={5}&amp;height=80&amp;appId=126328004123602\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:450px; height:80px;\" allowTransparency=\"true\"></iframe>",
            post.AbsoluteLink.AbsoluteUri, bSettings.Layout, bSettings.ShowFaces, bSettings.Width, bSettings.Action, bSettings.ColorScheme);
        sBuild.AppendLine(likeScript);
        sBuild.AppendLine("</div>");
        e.Body += sBuild.ToString();
    }

    private void InitializeSettings()
    {
        var settings = new ExtensionSettings(ExtensionName);
        settings.Help = "Enable facebook Like button on Post Home page and Post page";

        settings.IsScalar = true;
        settings.AddParameter("ShowPostList", "Display Like button on featured list", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("ShowFaces", "Show Faces (Show profile pictures below the button)", 20, false, false, ParameterType.Boolean);
        settings.AddParameter("Width", "Width (the width of the plugin in pixel)", 20, false, false, ParameterType.String);
        settings.AddParameter("Action", "Verb to display", 20, false, false, ParameterType.DropDown);
        settings.AddValue("Action", new string [] { "like", "recommend" }, "like");
        settings.AddParameter("ColorScheme", "Color Scheme (color scheme of the plugin)", 20, false, false, ParameterType.DropDown);
        settings.AddValue("ColorScheme", new string[] { "light", "dark" }, "light");
        settings.AddParameter("SelectedLayout", "Layout Style", 20, false, false, ParameterType.DropDown);
        settings.AddValue("SelectedLayout", new string[] { "standard", "button_count", "box_count" }, "standard");
        settings.AddValue("ShowPostList", true);
        _extensionSettings = ExtensionManager.InitSettings(ExtensionName, settings);
    }


    class ButtonSettings
    {
        public string Layout { get; set; }
        public string ShowFaces { get; set; }
        public string Width { get; set; }
        public string Action { get; set; }
        public string ColorScheme { get; set; }

        public ButtonSettings()
        {
            this.Layout = _extensionSettings.GetSingleValue("SelectedLayout") ?? "standard";
            this.ShowFaces = _extensionSettings.GetSingleValue("ShowFaces") ?? "false";
            this.Width = _extensionSettings.GetSingleValue("Width") ?? "450";
            this.Action = _extensionSettings.GetSingleValue("Action") ?? "like";
            this.ColorScheme = _extensionSettings.GetSingleValue("ColorScheme") ?? "light";
        }
    }
}

The overall code looks good. I have a small change as per the Facebook Like button code from facebook site. If this also does not work, please share your blog web address and i will see what could be the issue.

 

 

Tried your code change, but so far no luck.. i can try sharing the address as a next step.

Oct 12, 2011 at 8:42 PM
Edited Oct 13, 2011 at 2:13 PM

I've found the issue to be the same on other sites too.. see below...

Oct 13, 2011 at 2:13 PM
Edited Oct 13, 2011 at 2:15 PM

I've narrowed this down to an issue with the "virtual/dynamic" post pages and sharing those.. it seems alot of blogengine 2.5 sites out there have the same issue.. for instance:

 

try this

http://www.facebook.com/sharer/sharer.php?u=http://www.bloggersonline.com/demo/post/2011/10/13/test-test.aspx

You get the country code issue..

 

But if you cut off the /demo part to the end, then its fine.

A few sites DO work, i cant figure out why though.

Not sure what is going on with that dynamically created page to cause the issue?

 

**it also seems that that initial "2.5 blogengine" post is fine, but any subsequent ones are not, which is odd.

 

 

Oct 13, 2011 at 4:00 PM

I'm not experiencing this issue either on my main BE site or a virtual BE site. I'm wondering if you have a problem with DNS or maybe it's server/hosting related?

Oct 13, 2011 at 4:28 PM
MGD_King wrote:

I'm not experiencing this issue either on my main BE site or a virtual BE site. I'm wondering if you have a problem with DNS or maybe it's server/hosting related?

I'd probably think it was, except that when you switch to using the permalink url (based off the id of the blog post) it works fine.. so this seems to tell me its the dynamic aspx generation thats confusing the sharer.aspx

Oct 13, 2011 at 6:16 PM
Edited Oct 13, 2011 at 6:19 PM
MGD_King wrote:

I'm not experiencing this issue either on my main BE site or a virtual BE site. I'm wondering if you have a problem with DNS or maybe it's server/hosting related?

Are you filling in the excerpt field when you make a new post? 

Either that or i'm wondering if there is some blogengine setting that differs.. that makes yours work where mine doesnt.. did you upgrade from a previous release or was this 2.5 fresh?

Oct 13, 2011 at 6:42 PM
Edited Oct 13, 2011 at 6:57 PM

I do notice that on my auto generated dynamic post.aspx page, in the code there is this

 

<div id="comment-form">

    <img src="test-post-after-change.aspx_files/ajax-loader.gif" alt="Saving the comment" style="display: none;" id="ajaxLoader"> 
    <span id="status"></span>

    <div class="commentForm">
      <h3 id="addcomment">Add comment</h3>

      <input name="ctl00$cphBody$CommentView1$hiddenReplyTo" id="ctl00_cphBody_CommentView1_hiddenReplyTo" type="hidden">
        <p id="cancelReply" style="display:none;"><a href="javascript:void(0);" onclick="BlogEngine.cancelReply();">Cancel reply to comment</a></p>
     
      <p>
          <label for="txtName634541108354054932" class="lbl-user">Name*</label>
          <input class="txt-user" name="txtName634541108354054932" id="txtName634541108354054932" tabindex="2" value="Admin" type="text">
          <span id="spnNameRequired" style="color:Red;display:none;"> Required</span>
          <span id="spnChooseOtherName" style="color:Red;display:none;"> Please choose another name</span>
      </p>
      <p>
          <label for="ctl00_cphBody_CommentView1_txtEmail" class="lbl-email">E-mail*</label>
          <input name="ctl00$cphBody$CommentView1$txtEmail" value="post@example.com" id="ctl00_cphBody_CommentView1_txtEmail" tabindex="3" class="lbl-email" type="text">
          <span id="gravatarmsg"></span>
          <span id="ctl00_cphBody_CommentView1_RequiredFieldValidator2" style="color:Red;display:none;">Required</span><span id="ctl00_cphBody_CommentView1_RegularExpressionValidator1" style="color:Red;display:none;">Please enter a valid e-mail</span>
      </p>
     
      <p>
          <label for="ctl00_cphBody_CommentView1_ddlCountry" class="lbl-country">Country</label>
          <select name="ctl00$cphBody$CommentView1$ddlCountry" id="ctl00_cphBody_CommentView1_ddlCountry" tabindex="5" class="txt-country" onchange="BlogEngine.setFlag(this.value)">
    <option value="">[Not specified]</option>
    <option value="af">Afghan<layer id="searchwp-highlighting4" highlight="term-2" class="searchwp-term">is</layer>tan</option>
    <option value="al">Albania</option>
    <option value="dz">Algeria</option>
    <option value="ar">Argentina</option>
    <option value="am">Armenia</option>

 

 

 

This is where the not specified is coming from.. these comment options dont appear elsewhere.

I think the key difference here is that you dont have a country pull down for comments, whereas mine does.. not sure if this is theme related or not?

 

**UPDATE:  turned off country selector in the settings.. existing posts still have the issue, but newer ones do not.. however, my new posts if you facebook share them, only provide a URL and not a "body" or preview for some reason.

 

Oct 13, 2011 at 7:29 PM
markm75 wrote:
Are you filling in the excerpt field when you make a new post? 

Either that or i'm wondering if there is some blogengine setting that differs.. that makes yours work where mine doesnt.. did you upgrade from a previous release or was this 2.5 fresh?

I created a new post and entered text in the excerpt field and it allowed me to post to Facebook via the extension I use (which is darn near what you're using). I compared my settings to what is used here http://www.bloggersonline.com/demo/post/2011/10/13/test-test.aspx from the above post, and even logged into that Admin section and compared the settings between my set up and what's there. The only difference in that the BloggersOnline Demo site doesn't have my extension running, and it still won't work, so I would think that takes the extension out of the equation. The only differences being that my blog is running under the site root where as the demo is running under the DEMO subdirectory. However, I created a sub-blog and was able to post to FB as well, so I don't think the sub-directory has anything to do with it so let's remove that from the equation (for now, may add it back). So that leaves server configurations, right?

Oct 13, 2011 at 7:31 PM

For what it's worth, I don't have Country Selection turned on when posting a comment.

Oct 13, 2011 at 7:35 PM

So I went back to the Bloggers Online Demo (whoever did that, THANKS!!! Great for testing a default install!!!!) and disabled the Country Chooser and you're right, new posts work fine! Try the new post http://www.facebook.com/sharer/sharer.php?u=http://www.bloggersonline.com/demo/post/2011/10/13/A-one-and-a-two-and-a-three-and-a-four!.aspx as compared to the original post http://www.facebook.com/sharer/sharer.php?u=http://www.bloggersonline.com/demo/post/2011/10/13/test-test.aspx and see what happens.

Oct 13, 2011 at 7:39 PM

Ohh..i got your issue after seeing your blog now...

The link that is getting shared when i click on Like button is correct but the text that appears is not what you intend to share,

The reason nehind this is that you don't have any other content on your blog post. The LIKE button code scraps/reads your blog page to extract the relevant content and then shares some text on facebook.

You can add the short description/excerpt in your post and see the changes.

Be default, when you add a description to your BE post, it is added to the META description tag and facebook picks it from there. Since, in your case, the post body is blank, facebook is reading whatever content is available and showing it on FB wall.

Let me know if you need more information.

Oct 13, 2011 at 7:48 PM
anil21_22gupta wrote:

Ohh..i got your issue after seeing your blog now...

The link that is getting shared when i click on Like button is correct but the text that appears is not what you intend to share,

The reason nehind this is that you don't have any other content on your blog post. The LIKE button code scraps/reads your blog page to extract the relevant content and then shares some text on facebook.

You can add the short description/excerpt in your post and see the changes.

Be default, when you add a description to your BE post, it is added to the META description tag and facebook picks it from there. Since, in your case, the post body is blank, facebook is reading whatever content is available and showing it on FB wall.

Let me know if you need more information.

Hmm, puzzled, because in this test post i just made, i have body text.. so for facebook to put something other than the url repeated for a "description" you mean each time a blog is posted it must have some of the body put in the Excerpt field? I could have sworn i had seen this work without doing that, but maybe not.

 

Oct 13, 2011 at 8:00 PM
Edited Oct 13, 2011 at 8:07 PM
anil21_22gupta wrote:

Ohh..i got your issue after seeing your blog now...

The link that is getting shared when i click on Like button is correct but the text that appears is not what you intend to share,

The reason nehind this is that you don't have any other content on your blog post. The LIKE button code scraps/reads your blog page to extract the relevant content and then shares some text on facebook.

You can add the short description/excerpt in your post and see the changes.

Be default, when you add a description to your BE post, it is added to the META description tag and facebook picks it from there. Since, in your case, the post body is blank, facebook is reading whatever content is available and showing it on FB wall.

Let me know if you need more information.

That's not the issue because all of the test posts I tried (on my blog and on the Bloggers Online Demo) don't have any excerpt text and they all have text in the post body. The problem, as markm75 discovered, is the Country Chooser field in the comment section. I disabled that on the Demo site and it works as expected. I don't have it enabled for my blog and that's why I never saw the issue. For whatever reason FB gets hung up on the Select Country option when parsing the HTML from the page. Seems to me that this would be a more common issue, not with just BE or the extension, but any page that has a selection form in it that doesn't have a default setting other than NOT SPECIFIED.

****And for the record, I just tried a test post with no text in the body and no text in the excerpt and it posted fine WITHOUT the Country Chooser option enabled and it posts to FB just fine.

Oct 13, 2011 at 8:14 PM
MGD_King wrote:
anil21_22gupta wrote:

Ohh..i got your issue after seeing your blog now...

The link that is getting shared when i click on Like button is correct but the text that appears is not what you intend to share,

The reason nehind this is that you don't have any other content on your blog post. The LIKE button code scraps/reads your blog page to extract the relevant content and then shares some text on facebook.

You can add the short description/excerpt in your post and see the changes.

Be default, when you add a description to your BE post, it is added to the META description tag and facebook picks it from there. Since, in your case, the post body is blank, facebook is reading whatever content is available and showing it on FB wall.

Let me know if you need more information.

That's not the issue because all of the test posts I tried (on my blog and on the Bloggers Online Demo) don't have any excerpt text and they all have text in the post body. The problem, as markm75 discovered, is the Country Chooser field in the comment section. I disabled that on the Demo site and it works as expected. I don't have it enabled for my blog and that's why I never saw the issue. For whatever reason FB gets hung up on the Select Country option when parsing the HTML from the page. Seems to me that this would be a more common issue, not with just BE or the extension, but any page that has a selection form in it that doesn't have a default setting other than NOT SPECIFIED.

****And for the record, I just tried a test post with no text in the body and no text in the excerpt and it posted fine WITHOUT the Country Chooser option enabled and it posts to FB just fine.

yeah it still amazes me noone else ever mentioned anything about the country selector issue..

 

So it seems that if you want to have a description when you share a post, the original post must have an excerpt, otherwise all that is shared is a link.. as in your case for example.. btw, curious, in the about section how did you get the graphic in there, as it shows up in the facebook share which is nice.. i tried just editing the widget box, but it wont even let me type in my existing one anyway..

 

http://www.facebook.com/sharer/sharer.php?u=http://www.mgdking.com/post/2011/03/29/FaceBook-Like-Extension-for-BlogeEnginenet.aspx

 

Oct 13, 2011 at 8:14 PM

@MGD_king..

ya..may be you are right. But in my case, it always picks up the excerpt.

But its good that we now know the issue and its solution.

Oct 13, 2011 at 8:55 PM
Edited Oct 13, 2011 at 9:18 PM
markm75 wrote:

So it seems that if you want to have a description when you share a post, the original post must have an excerpt, otherwise all that is shared is a link.. as in your case for example.. btw, curious, in the about section how did you get the graphic in there, as it shows up in the facebook share which is nice.. i tried just editing the widget box, but it wont even let me type in my existing one anyway..

http://www.facebook.com/sharer/sharer.php?u=http://www.mgdking.com/post/2011/03/29/FaceBook-Like-Extension-for-BlogeEnginenet.aspx

Not necessarily. The link that you posted there pulls up content from the post's body. I don't have any excerpt text in that post, so FB pulls from the body if it can't find the <description> tag.

What image are you talking about?

@anil21_22qupta...
FB will always pick the up excerpt text (I never knew until now) because FB is looking for the page's <description> tag and the Excerpt field becomes the <description> tag. It all makes sense now!

Oct 14, 2011 at 6:20 AM

@MGD_King

Yes. The excerpt content is added to meta description tag (invisible to user) by BE automatically and FB then reads it to show on shared links.

@markm75 -

If you are talking about the thumbnail image that is shown against the LIKEd link on FB wall, then it is picked up by FB automatically based on certain image size criteria from your

shared web page.

There is a way to tell FB to use a specific image that you want from your blog post to show as a thumbnail too. FB basically follows an open graph protocol (something like META tags in head section) and lets you

specify the address of the image that you want to show as a thumbnail. I have created a small extention for this and you may like to use it:

http://am22tech.com/s/22/Blogs/post/2011/09/26/BE-Extension-Facebook-Thumbnail-Image.aspx

 

Oct 14, 2011 at 4:30 PM
MGD_King wrote:
markm75 wrote:

So it seems that if you want to have a description when you share a post, the original post must have an excerpt, otherwise all that is shared is a link.. as in your case for example.. btw, curious, in the about section how did you get the graphic in there, as it shows up in the facebook share which is nice.. i tried just editing the widget box, but it wont even let me type in my existing one anyway..

http://www.facebook.com/sharer/sharer.php?u=http://www.mgdking.com/post/2011/03/29/FaceBook-Like-Extension-for-BlogeEnginenet.aspx

Not necessarily. The link that you posted there pulls up content from the post's body. I don't have any excerpt text in that post, so FB pulls from the body if it can't find the <description> tag.

What image are you talking about?

@anil21_22qupta...
FB will always pick the up excerpt text (I never knew until now) because FB is looking for the page's <description> tag and the Excerpt field becomes the <description> tag. It all makes sense now!

Here is my example of it not pulling the body on mine anyway..

http://tech-stew.com/

if you go there, the first posting "Test posting", it has body content, no excerpt, but if you click the facebook share, it doesnt grab the body, just the url.. unclear as to why this is.

Oct 14, 2011 at 4:45 PM
Edited Oct 14, 2011 at 4:51 PM
markm75 wrote:
MGD_King wrote:
markm75 wrote:

So it seems that if you want to have a description when you share a post, the original post must have an excerpt, otherwise all that is shared is a link.. as in your case for example.. btw, curious, in the about section how did you get the graphic in there, as it shows up in the facebook share which is nice.. i tried just editing the widget box, but it wont even let me type in my existing one anyway..

http://www.facebook.com/sharer/sharer.php?u=http://www.mgdking.com/post/2011/03/29/FaceBook-Like-Extension-for-BlogeEnginenet.aspx

Not necessarily. The link that you posted there pulls up content from the post's body. I don't have any excerpt text in that post, so FB pulls from the body if it can't find the <description> tag.

What image are you talking about?

@anil21_22qupta...
FB will always pick the up excerpt text (I never knew until now) because FB is looking for the page's <description> tag and the Excerpt field becomes the <description> tag. It all makes sense now!

Here is my example of it not pulling the body on mine anyway..

http://tech-stew.com/

if you go there, the first posting "Test posting", it has body content, no excerpt, but if you click the facebook share, it doesnt grab the body, just the url.. unclear as to why this is.

I should mention, i'm running addthisdotnetv5.. i noticed it has an option "addthis" enabled or disabled, which basically is facebook and twitter mini icons, then if you also scroll down in this extension there is facebook share and facebooklike.. if those are enabled duplicate icons appear.. the addthis version of facebook share first connects to addthis.com and then DOES show the body in the posting that is bout to be created for facebook, whereas the other "Facebookshare" button does not, it just uses the standard sharer.php file.

It appears to be taking on something at the end like this

 

http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ftech-stew.com%2Fpost%2F2011%2F10%2F14%2FTest-posting-for-oct-14-2011.aspx%23.TphoK7oC-AY.facebook

vs

http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Ftech-stew.com%2Fpost%2F2011%2F10%2F14%2FTest-posting-for-oct-14-2011.aspx&src=sp

Oct 14, 2011 at 6:54 PM
anil21_22gupta wrote:

@MGD_King

Yes. The excerpt content is added to meta description tag (invisible to user) by BE automatically and FB then reads it to show on shared links.

@markm75 -

If you are talking about the thumbnail image that is shown against the LIKEd link on FB wall, then it is picked up by FB automatically based on certain image size criteria from your

shared web page.

There is a way to tell FB to use a specific image that you want from your blog post to show as a thumbnail too. FB basically follows an open graph protocol (something like META tags in head section) and lets you

specify the address of the image that you want to show as a thumbnail. I have created a small extention for this and you may like to use it:

http://am22tech.com/s/22/Blogs/post/2011/09/26/BE-Extension-Facebook-Thumbnail-Image.aspx

 

 

Yeah, the thumbnail for fb.. i tried your extension.. it didnt seem to add the meta property, so i added one manually and that didnt work either.. not sure what is going on..

 

MGD, on your site, if i like one of your posts, it used to show your image from the about section now it doesnt show an image at all.

I think ideally if there were no pictures in the post itself, that it would take the site logo image as the thumbnail for facebook, at least i think this is how it works on other sites.

 

I still cant get the body text to show up, with the facebooklike v1.0 or 1.1 plugins.. it only works with addthis.com and v5

 

Oct 15, 2011 at 3:35 AM

I just checked your tech-stew.com and looks like the extension is not active. But i saw the page source and saw that you have added the open graph meta tag to provide path of tech-stw logo. But this code statement is also commented.

The extension works great on my BE implementation and you can see it in action on http://am22tech.com

It actually picks up the first image from the post body. If there is no image in your post body, it will NOT add any meta tag.

Let me know if you need any help with the extension.

Oct 15, 2011 at 1:03 PM
Edited Oct 15, 2011 at 1:05 PM
markm75 wrote:

MGD, on your site, if i like one of your posts, it used to show your image from the about section now it doesnt show an image at all.

I think ideally if there were no pictures in the post itself, that it would take the site logo image as the thumbnail for facebook, at least i think this is how it works on other sites.

 

I still cant get the body text to show up, with the facebooklike v1.0 or 1.1 plugins.. it only works with addthis.com and v5

 

anil21_22qupta is right, FB picks up the first image from the post body. I usually don't post images in my posts so that's why you see the picture from my "about me" section when you like a post.

Oct 19, 2011 at 2:16 PM
anil21_22gupta wrote:

I just checked your tech-stew.com and looks like the extension is not active. But i saw the page source and saw that you have added the open graph meta tag to provide path of tech-stw logo. But this code statement is also commented.

The extension works great on my BE implementation and you can see it in action on http://am22tech.com

It actually picks up the first image from the post body. If there is no image in your post body, it will NOT add any meta tag.

Let me know if you need any help with the extension.

I tried it with the facebook share button and the like button on this post:

http://am22tech.com/s/22/Blogs/post/2011/10/06/Google-Voice-Search-Box.aspx

In either case i dont get an image on facebook or on the preview window..

Not sure why?

Oct 19, 2011 at 5:14 PM

@markm75

This is because the Facebook only shows the image if it is at least 50px x 50px in size AND has the maximum aspect ratio of 3:1.

The very first image on this post that you tested does not qualify as per the criteria and hence is not shown.

Look at some other posts and you will see the image.

Note: The extension that i have created picks the first image from the post. You can change the logic to pick any image whatsoever!

Oct 20, 2011 at 2:42 AM
Edited Oct 20, 2011 at 2:49 AM
anil21_22gupta wrote:

@markm75

This is because the Facebook only shows the image if it is at least 50px x 50px in size AND has the maximum aspect ratio of 3:1.

The very first image on this post that you tested does not qualify as per the criteria and hence is not shown.

Look at some other posts and you will see the image.

Note: The extension that i have created picks the first image from the post. You can change the logic to pick any image whatsoever!

I'm slightly puzzled... so my "test from iphone" entry at http://tech-stew.com  it is using an image that works on a different site, i figured if it worked there should here.. i also think it meets the criteria too.. i enabled your extension, but is that all you really need do, just enable?  so when i click any of the share to fb or like on fb buttons i still dont get an image.. i did not modify the meta as of yet to have the entry to choose a default one if criteria isnt met though.

EDIT:  and if you look at test-33333, i copied the content of that post from the other site and low and behold it does indeed show the first image.. not sure what is up with the blog entry "test from iphone", must just not match criteria i guess  ANd on that test-33333, the image it was using for the thumbnail on anandtech, its not even visible in the actual article i can see, so they must have something tweaked behind the scenes i guess.

The source for it is http://external.ak.fbcdn.net/safe_image.php?d=AQAiqvI3E4yy8AI0&url=http%3A%2F%2Fimages.anandtech.com%2Fdoci%2F4991%2FScreen+Shot+2011-10-19+at+12.30.36+PM_carousel.png  Must be using a different set of criteria and somehow facebook sharer likes the image in that case.

Oct 21, 2011 at 8:24 AM

It does not really matter if the image is indeed shown on the post to user or not. Facebook only reads the meta Og tag to know the path of the image.

If the tag is not there, it tries to scan the page's html code and find a suitable image...most probably the first image or any image that it has cached earlier from your site.

The Og Tag helps you specify a different image for each new post. The FB will stay away from scanning the page if you have already specified the tag.

Does that answer your question?

Nov 2, 2011 at 6:19 PM
Edited Nov 2, 2011 at 8:59 PM
anil21_22gupta wrote:

It does not really matter if the image is indeed shown on the post to user or not. Facebook only reads the meta Og tag to know the path of the image.

If the tag is not there, it tries to scan the page's html code and find a suitable image...most probably the first image or any image that it has cached earlier from your site.

The Og Tag helps you specify a different image for each new post. The FB will stay away from scanning the page if you have already specified the tag.

Does that answer your question?

 

Yeah, things are rollin on my site now.. it seems though, i had to resize my images.. i had them 600 px wide at one point.. since going to say 400x250 etc.. suddenly the facebook like extension is pulling the article image.

Not sure how to handle this if a bigger image was needed.. i suppose starting small then offering a click to enlarge.

 

Now the issue i have is that the google plus button always defaults to the site logo jpg (from the meta og:image tag).. google plus doesnt seem to want to look into the articles themselves, but rather stop at the meta.. have u ran into this one?

**i noticed on one of your posts that somehow you have the meta og:image pointing at a png on that page itself.. how did you get that to work, being as the page is dynamically created?  (i've tried putting meta tags in the raw html of the post but that never helped).. so it would seem that your plus ones are at least getting the images.. though in some cases only a portion of the image.

It was my understanding that your extension should have made my meta tag og:image change to the image in the posting by default on the fly..

Maybe the issue here is that i've added the meta tag to the master page of the site for the site logo and its overriding your extension?

I removed the meta tag i manually had added to the master, this didnt help with the google plus one situation.. and a few of my posts still dont show an image despite this. 

**by the way, i'm using your qr code extension.. i cant seem to make it smaller than 130x130, if i try 120x120.. i get a ton of extra white space around the code, which is undesirable.. i tried to figure out where it came from but had no luck, so for now i'm leaving it at 130x130

Apr 13, 2012 at 5:57 PM
anil21_22gupta wrote:

It does not really matter if the image is indeed shown on the post to user or not. Facebook only reads the meta Og tag to know the path of the image.

If the tag is not there, it tries to scan the page's html code and find a suitable image...most probably the first image or any image that it has cached earlier from your site.

The Og Tag helps you specify a different image for each new post. The FB will stay away from scanning the page if you have already specified the tag.

Does that answer your question?

unfortunately this just doesn't always work, sometimes it does, sometimes it doesnt.. the only sure fire way i have found to get facebook sharing and thumbnails to work, is to keep the resolution of the image rather small.. examining other sites, it seems they manually specify a thumbnail image from their site in the meta code..

What i think is needed is a way when you are creating blog posts, to manually specify the meta tag.. is there some way to do this?  I could then point the meta og:image tag to a smaller thumbnail version of an image from the post (which isn't visible in the post itself, solving the issue).

Apr 13, 2012 at 7:22 PM
markm75 wrote:
anil21_22gupta wrote:

It does not really matter if the image is indeed shown on the post to user or not. Facebook only reads the meta Og tag to know the path of the image.

If the tag is not there, it tries to scan the page's html code and find a suitable image...most probably the first image or any image that it has cached earlier from your site.

The Og Tag helps you specify a different image for each new post. The FB will stay away from scanning the page if you have already specified the tag.

Does that answer your question?

unfortunately this just doesn't always work, sometimes it does, sometimes it doesnt.. the only sure fire way i have found to get facebook sharing and thumbnails to work, is to keep the resolution of the image rather small.. examining other sites, it seems they manually specify a thumbnail image from their site in the meta code..

What i think is needed is a way when you are creating blog posts, to manually specify the meta tag.. is there some way to do this?  I could then point the meta og:image tag to a smaller thumbnail version of an image from the post (which isn't visible in the post itself, solving the issue).

Actually i found a workaround.. I added the line <link rel="image_scr" href="http://fullsitehere.com/image.axd?picture=testthumb.jpg"/> to the very top of each post.. in raw html mode..

 

but the key was the testthumb.jpg.. it had to be very small.. say under 130x110 for this to work.. then i ran the main page through the debugger for fb.. then tested it on a fb share and the image shows.

Whats nice is you can reference the image path above on a fb share (without submitting), this tells you whether or not the image is the right size to show as a thumbnail.

FB seems really flaky on what works for thumbnails.

So for now i still have your extension going that takes the first image as the og:Image meta tag, but the <link rel one above seems to override that and use the thumbnail version which i manually add and resize.

The resizing of the image comes locally, then gets uploaded to blogengine and referenced.

It would be nice if your extension would somehow manually resize the image to under 130x110 and reference this resized image automatically in the meta code, so that existing images could just be used on the fly in their smaller thumbnail versions (without manually resizing them).