Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to test open graph on localhost

I've done a lot of research and haven't found a definitive answer to this. Is there anyway to test the open graph on localhost? I don't haven any issues using the graph api on locahost.

I've changed my website url in the app settings and have even tried setting up a domain in my hosts file but the debugger linter for open graph tries to use the actual domain instead of my localhost and when using locahost directly the linter completely fails connecting.

Does anybody have any workarounds for this?

like image 640
DavidB Avatar asked Dec 20 '11 01:12

DavidB


People also ask

How does an Open Graph work?

Open Graph is a technology first introduced by Facebook in 2010 that allows integration between Facebook and its user data and a website. By integrating Open Graph meta tags into your page's content, you can identify which elements of your page you want to show when someone share's your page.

How do you test an Open Graph?

Using an Open Graph Checker You can go to smallseotools.com and use the OG checker tool. Once you navigate to the website; enter the URL of the website you want the meta og checker tool to check. It will run a check and if it finds the tags it will display them.

How do I use Open Graph tags on my website?

Just go to Page Settings > Social Image > Upload. If you need to add other OG tags and customize the default settings, go to Page Settings > Advanced > Page Header Code Injection. Read the following section on adding the tags manually and copy-paste the code there.


1 Answers

Using a local proxy is the right solution. ngrok didn't work for me neither.

A similar tool that did work with facebook debugger is localtunnel

npm install -g localtunnel lt --port 8000 

Generates a url that looks something like https://<random_hash>.localtunnel.me/. Using this url in facebook open graph debugger worked for me as of October 18th 2017. I only had to hit Fetch new scrape information button. 🍻

Cool thing about localtunnel is that you can easily host your own localtunnel server with github.com/localtunnel/server so if it ever stops working with localtunnel.me, you can run your own somewhere in the cloud

like image 190
GabLeRoux Avatar answered Sep 28 '22 01:09

GabLeRoux