We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46164
    • 5 Posts
    Hi

    I'm trying to add a Facebook Share button to my templates. I have implemented the code given here: http://modx.com/extras/package/facebookpageshareicon, but I would like to make the following modifications:


    • Use the default Share button, and show count
    • Have it show the page image, and an excerpt of text, or the meta description

    I'd be really grateful if anyone could point me in the right direction.

    Thanks
      • 14214
      • 299 Posts
      I have only used the code from the Facebook site for my share buttons, following their instructions should work fine for you.

      You will want to build some parameters into your template or resources for their Open Graph protocol. Check out the link below which has some very helpful information.

      http://webdesign.tutsplus.com/articles/seo-articles/take-control-of-your-social-snippets/

      Other sites use Open Graph too such as LinkedIn. LinkedIn is a killer though as they cache a link's snippet as soon as you paste it in your post. Change the page info and the snippet does not update on LinkedIn for a while - 7+ days.

      Hope this helps.
        • 46164
        • 5 Posts
        Thanks for this. Your link and the Share button page on the Facebook site only seem to provide instructions for absolute URLs - however, I need this to work dynamically. Any way I can do this?
          • 14214
          • 299 Posts
          Maybe I do not understand what you mean, but here is what I am using as a chunk inside of my templates and it is working well for me:

          <meta property="og:image" content="[[++site_url]][[*catimage]]" >
          <meta property="og:image" content="[[++site_url]][[++logo_image]]" >
          <meta property="og:image" content="[[++site_url]][[++image]]" >
          <meta property="og:description" content="[[*introtext]]" />
          <meta property="og:site_name" content="[[++site_name]]" />
          <meta property="og:link" content="[[++site_url]][[~[[*id]]]]" />
          <meta property="og:title" content="[[*pagetitle]]" />