Skip to Content Skip to Menu

OpenGraph tags in activity posts?

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 392
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 month 4 days ago #339597 by liaskas
OpenGraph tags in activity posts? was created by liaskas
Hello...
I created an auto action to add open graph tags to user profile pages and it works pretty fine! (Used an example that we found here in the forum. Thanks for that.)
The action that we use is...
<meta property="og:title" content="[username] Profile" /]" />
<meta property="og:description" content="[DESCRIPTION FIELD]" /]" />
<meta property="og:image" content="[avatar]" />
<meta property="og:image:width" content="220" />
<meta property="og:image:height" content="220" />
... and so on.

Now we need to ad open graph tags to individual cb_activity posts so that they can be shared to social.
No matter how much i searched in the forum, i can not find anything related to this. So it is either i have missed something in cb_activity configuration that makes this procedure automated, or i will need help on calling the corresponding cb_activity fields to substitute them in an auto action and set the og tags for each post.

Thank you in advance for your kind help.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48603
  • Thanks: 8300
  • Karma: 1445
1 month 3 days ago #339601 by krileon
Replied by krileon on topic OpenGraph tags in activity posts?
You'll need to act on the activity_onDisplayActivity trigger. Next use the following condition to know when a post is being viewed directly.

Field: Custom > Value
Custom Value: [var3_isRow]
Operator: Equal To
Value: 1

With the new trigger helper functionality built in you'll see all the available variables for that trigger once selected.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 392
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 month 3 days ago - 1 month 3 days ago #339609 by liaskas
Replied by liaskas on topic OpenGraph tags in activity posts?
Thank you for your reply Krileon. We have created a new auto action according to your suggestion but probably it is not enough. Is it possible that you give me an example of how we get the og meta property in the page source? Do we need to add actions? Can you give me an example?
Last edit: 1 month 3 days ago by liaskas.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48603
  • Thanks: 8300
  • Karma: 1445
1 month 3 days ago #339612 by krileon
Replied by krileon on topic OpenGraph tags in activity posts?
You'll need to use CB Auto Actions and create Code action on the activity_onDisplayActivity trigger. Then add the above condition to it so it only applies to direct activity post views. Your code action can use the metadata method to add whatever metadata you like to the page.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • liaskas
  • liaskas
  • ONLINE
  • Posts: 392
  • Thanks: 36
  • Karma: 2
  • Add-ons
1 month 3 days ago - 1 month 3 days ago #339613 by liaskas
Replied by liaskas on topic OpenGraph tags in activity posts?
This is what i suspected...

When i created the og meta tags for the profile view we substituted the cb fields like [username], [avatar], [description] etc.

How can we substitute the activity fields stored in database like article.id , title , message , uploaded image ? On the demo site there is nothing referring to this.
Last edit: 1 month 3 days ago by liaskas.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48603
  • Thanks: 8300
  • Karma: 1445
1 month 2 days ago #339615 by krileon
Replied by krileon on topic OpenGraph tags in activity posts?
Yes, you've full access to the activity object and its layout data from that trigger. Recommend taking a look at my blog post below regarding the new trigger helper feature built into CB Auto Actions that exposes the trigger variables to you.

www.joomlapolis.com/blog/kyle/19067-cb-auto-actions-9-3-0


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum