CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Facebook Open Graph meta tags
Pages: [1]

Author Topic: Facebook Open Graph meta tags  (Read 3130 times)

erogers

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.1
  • MySQL version: 5
  • PHP version: 5
Facebook Open Graph meta tags
November 22, 2011, 04:25:50 am
Is there way to specify custom meta tags for the title, description, image, etc. displayed in Facebook? 

Open Graph Meta Tags is a great Drupal plugin that adds an interface for this to page and story edit screens.  I'd love to have the same functionality for CiviCRM event and contribution pages.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Facebook Open Graph meta tags
November 22, 2011, 06:13:18 am
Hi,

Interesting idea, doesn't exist out of the box to my knowledge

What I did for something related was to create a new smarty plugin to alter the title of the page, so from within any template I could add a {page title="my text"} or {page title=contact.display_name}

(don't recall the detail of the syntax, but that's something along that line). Happy to share the code if it helps you implementing).

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Facebook Open Graph meta tags
November 22, 2011, 10:06:51 am
You might want to review the new feature which adds social networking plugins to public CiviCRM pages - and see if it makes sense to extend that for 4.2 to support meta tags:

http://issues.civicrm.org/jira/browse/CRM-8737
Protect your investment in CiviCRM by  becoming a Member!

erogers

  • I post occasionally
  • **
  • Posts: 74
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Wordpress 4.1
  • MySQL version: 5
  • PHP version: 5
Re: Facebook Open Graph meta tags
November 22, 2011, 10:19:27 am
This seems to simply enable sharing/liking buttons?

I'm looking for a way to edit the Open Graph meta tags in CiviCRM events and contribution pages, for example

<meta property="og:title" content="my contribution page title" />

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: Facebook Open Graph meta tags
February 23, 2012, 11:50:24 am
I wrote a small Drupal 7 module that does this for "PCP info" pages:
https://github.com/mlutfy/civicrmogp

To get it in core would require a wrapper function to "insert a tag in the html head" (equivalent to drupal_add_html_head). I don't have time to propose a patch now, but could work on it during the April code sprint.
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

TimG

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
  • CiviCRM version: 4.4.6
  • CMS version: Joomla 2.5.24
  • MySQL version: 5.5.37
  • PHP version: 5.4.23
Re: Facebook Open Graph meta tags
April 27, 2012, 02:52:18 am
I've just implemented ITPMeta for Joomla - lets you add OG: tags to *any* page. Worth a search - they might do a Drupal version

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Facebook Open Graph meta tags
January 25, 2013, 12:44:12 pm
@mlutfy - I'm looking to do the exact same thing, but for Contribution pages. I'm not a coder, though - is there any guidance you could supply here? And while I'm here, how difficult would it be to extend the functionality to both PCP and Contribution pages at the same time?

Hoping you can help... thanks!

mathieu

  • Administrator
  • Ask me questions
  • *****
  • Posts: 620
  • Karma: 36
    • Work
  • CiviCRM version: 4.7
  • CMS version: Drupal
  • MySQL version: MariaDB 10
  • PHP version: 7
Re: Facebook Open Graph meta tags
January 25, 2013, 04:38:27 pm
@bcobin: I added title/description support for Contribution pages, but I haven't really tested it. Let me know if it works :)

https://github.com/mlutfy/civicrmogp
CiviCamp Montréal, 29 septembre 2017 | Co-founder / consultant / turn-key CiviCRM hosting for Quebec/Canada @ SymbioTIC.coop

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Facebook Open Graph meta tags
January 26, 2013, 10:35:57 am
@mlufty

Thanks so much - works like a treat if you activate the lines you commented out for the logo image (which I needed in my case.)

Huge help - thanks again.. you rock!

Code: [Select]
/* removing for now, since not really needed (in my use case) */
         // adds: <meta property="og:image" content="http://[...]" />
         $image = theme_get_setting('logo');
         $element = array(
           '#tag' => 'meta',
           '#attributes' => array(
             'property' => 'og:image',
             'content' => $image,
           ),
         );
         drupal_add_html_head($element, 'ogp_image_default');

      // Add the image

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Discussion (deprecated) »
  • Feature Requests and Suggestions (Moderator: Dave Greenberg) »
  • Facebook Open Graph meta tags

This forum was archived on 2017-11-26.