OpenGraph - select where og: url points / redirects the user and supports tags

I am trying to implement actions and an OpenGraph object. It works great, I can create objects and actions in the ticker / Timelime.

My only problem is when you show the object, its title is a link. But it links to the page that I use to create the object, so nothing is visible:

object.html.erb

<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# name_space: http://ogp.me/ns/fb/name_space#"> <meta property="fb:app_id" content="APP_ID" /> <meta property="og:type" content="name_space:object" /> <meta property="og:url" content="PATH_TO_METHOD_TO_CREATE_OBJECT?img_link=<%= CGI.escape(@img_link)%>&points=<% =@points %>&description=<%= @description%>" /> <meta property="og:title" content="<%= params[:units_offered] %> Points" /> <meta property="og:description" content="<%= params[:description] %>" /> <meta property="og:image" content="<%= params[:img_link] %>"> 

if I change the og: url meta tag to the url of my FB page, then the object selects my FB page value ..

Ideally, I wanted to link to nothing or to my FB page.

Any clue?

Thanks!

+4
source share
2 answers

Since linter does not run javascript, you can do a javascript redirection for the user to go to the right place.

<script> location.href = 'http://example.com/the_real_page.php'; </script>

Thus, linter can still see the correct og meta tags, and the user who clicks on the link is redirected to the right place.

+7
source

Add this to head :

 <script type="text/javascript"> location = 'YOUR_HOME_PAGE'; </script> 
+1
source

Source: https://habr.com/ru/post/1397890/


All Articles