CMS Development

IamHamidd
Member

How to overwrite/replace the auto-generated Open Graph Tags (OG Tags) on HubSpot?

SOLVE

I would like to change the image and title of our social media post-sharing for a few web pages/blogs. Is there a way to overwrite or replace HubSpot's current auto-generated open graph tags (OG tags)? Could you please let me know if you have any other alternative ideas to implement? Website

 
0 Upvotes
1 Accepted solution
Anton
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How to overwrite/replace the auto-generated Open Graph Tags (OG Tags) on HubSpot?

SOLVE

Hi @IamHamidd., 

 

Yes - it's possible. To give users a easier access to them I've written a custom module a while back. 

You can grab it from my github here.

 

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

3 Replies 3
Anton
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How to overwrite/replace the auto-generated Open Graph Tags (OG Tags) on HubSpot?

SOLVE

Hi @IamHamidd., 

 

Yes - it's possible. To give users a easier access to them I've written a custom module a while back. 

You can grab it from my github here.

 

 

best, 

Anton

Anton Bujanowski Signature
BarryGrennan
Top Contributor

How to overwrite/replace the auto-generated Open Graph Tags (OG Tags) on HubSpot?

SOLVE

Very cool module @Anton!

 

Out of interest, why do you use the jQuery append method vs hubl require_head? Something to do with the order it would place them in?

 


profile2022aBarry Grennan

Freelance HubSpot CMS Developer

Website | Contact

 

 

Anton
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

How to overwrite/replace the auto-generated Open Graph Tags (OG Tags) on HubSpot?

SOLVE

Thank you @BarryGrennan

Yeah - It might have a loading order effect.

For my knowledge require_head will put the code into standard_header_inlcudes and when writing something for everybody where you don't know if standard_header_include is before or after everything necessary, the jQuery append method can be better. Otherwise the defaults from HubSpot would override it again 🙂 But thank you for the tipp - I'll think about updating the module.

 

Also: Feel free to modify it. 

 

p.s: Would really appreciate some credits 😊

 

best, 

Anton

Anton Bujanowski Signature