Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open graph can resolve relative url?

I'm adding Facebook Open Graph meta tag to my site. For example:

<meta property="og:image" content="../images/aa.jpg"/> 

Does Open Graph take relative URLs?

Otherwise, how can I convert a relative url to an absolute url in asp.net mvc3 - Is there any available function to do so?

like image 636
ebattulga Avatar asked Mar 25 '12 07:03

ebattulga


People also ask

Can OG image be relative path?

The Correct Answer They define the og:image value as the following... A string of Unicode characters forming a valid URL having the HTTP or HTTPS scheme. So that means that even though Relative URLs will work. Facebook uses a fallback approach for Invalid Full URLs.

What is Open Graph URL?

Open Graph meta tags are snippets of code that control how URLs are displayed when shared on social media. They're part of Facebook's Open Graph protocol and are also used by other social media sites, including LinkedIn and Twitter (if Twitter Cards are absent). You can find them in the <head> section of a webpage.

What is Open Graph protocol used for?

Open Graph is an internet protocol that was originally created by Facebook to standardize the use of metadata within a webpage to represent the content of a page. Within it, you can provide details as simple as the title of a page or as specific as the duration of a video.

What is an relative URL?

A relative URL is a URL that only includes the path. The path is everything that comes after the domain, including the directory and slug. Because relative URLs don't include the entire URL structure, it is assumed that when linking a relative URL, it uses the same protocol, subdomain and domain as the page it's on.


1 Answers

Documentation have nothing about it, but relative URLs will not work, only full URL including scheme works.

As long as only full URLs supported you may convert relative to absolute url using URL.Content method (as suggested in What is the equivalent to Page.ResolveUrl in ASP.NET MVC?)

NOTES:

  • In 2012 in old Facebook bug tracker this bug was closed stating this is "by design" http://developers.facebook.com/bugs/192471680829756
  • If you look into http://ogp.me/ns RDF schema (in Turtle) og:image specified as ogc:url which have next description:

A string of Unicode characters forming a valid URL having the http or https scheme.

like image 114
Juicy Scripter Avatar answered Sep 22 '22 00:09

Juicy Scripter