打开图可以解析相对URL? [英] Open graph can resolve relative url?

查看:82
本文介绍了打开图可以解析相对URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Facebook Open Graph元标记添加到我的网站.例如:

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

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

Open Graph是否使用相对URL?

Does Open Graph take relative URLs?

否则,如何在 asp.net mvc3 中将相对URL 转换为绝对URL -是否有可用的函数来执行是吗?

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

推荐答案

文档没有任何内容,但是相对URL将不起作用,只有包括方案在内的完整URL才能起作用.

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

只要仅支持完整的URL,就可以使用URL.Content方法相对于绝对URL进行转换(如中的建议)到ASP.NET MVC中的Page.ResolveUrl?)

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?)

注释:

  • 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:

一串Unicode字符,构成具有http或https方案的有效URL.

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

这篇关于打开图可以解析相对URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆