我正在开发我的应用程序中的OG模块。下面是与twitter和whasapp一起正常工作的URL,但显示了facebook的问题。
http://nvie.in/portal/gyany/product/145
这是facebook抓取工具在我的页面中看到的内容 -
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website">
<link rel="canonical" href="http://nvie.in/crawler-products-page.jsp">
</head>
<body>
</body>
</html>
这是我的代码
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<%@ page import="org.jsoup.*" %>
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<%
String appVersion= "1";
String portalId= request.getAttribute("portalId").toString();
String requestProtocol=request.getScheme();
String requestDomain=request.getServerName();
String requestPort=Integer.toString(request.getServerPort());
String requestBasePath = requestProtocol+"://"+requestDomain+":"+requestPort;
%>
<head>
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website" />
<link rel="canonical" href="<%=(request.getRequestURL().toString())%>">
<sql:query dataSource="jdbc/localMysql" var="result">
--- Query to fetch portal details---= '<%=portalId %>';
</sql:query>
<c:forEach var="row" items="${result.rows}">
<meta property="og:url" content="<%=(request.getRequestURL().toString())%>" />
<meta name= "twitter:card" content="summary" />
<meta name= "twitter:site" content="@####" />
<meta property="og:title" content='<c:out value=" ${row.portal_name} "/>' />
<meta property="og:description" content='<c:out value=" ${Jsoup.parse(row.portal_tagline).text()} "/>' />
<c:if test="${not empty row.file_url}">
<meta property="og:image" content='<%=requestBasePath%>/####/<c:out value="${fn:trim(row.file_url)}"/>' />
<meta name= "twitter:card" content="summary_large_image" />
</c:if>
</c:forEach>
</head>
<body>
</body>
</html>