为什么打开图标签<meta />在百里香模板上不起作用

时间:2019-05-03 15:08:21

标签: thymeleaf opengraph

我在百里香页上添加了开放图元标记。 当我尝试共享我的页面时-好像缺少标签。

我的页面(部分)代码

<!DOCTYPE html>
<html lang="ru" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      prefix="og: //ogp.me/ns#">
    <head>
        <meta charset="utf-8"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <link th:href="@{/css/app.css}" rel="stylesheet"/>
        <title th:text="${'pageTitle'}">Title</title>

        <meta property="og:type"  content="article" />
        <meta property="og:url"   th:content="${'https://my_site_url'}" />
        <meta property="og:title" th:content="${'pageTitle'}" />
        <meta property="og:description"   th:content="${'DESCRIPTION'}" />
        <meta property="og:image"         th:content="@{'https://pp.vk.me/c629531/v629531034/3172e/xEBYyER1WE4.jpg'}" />
    </head>

    <body>
        <section class="base fullpage">
            <div class="fullpage__content">
                <div th:replace="component/partial/header"/>
                <div th:replace="${page}"/>
            </div>
            <div class="fullpage__bottom">
                <div th:replace="component/partial/footer"/>
            </div>
        </section>
        <div th:replace="component/auth/auth"/>
    </body>
</html>

我的共享页面按钮

<a th:href="@{'https://twitter.com/share?url=' + ${full_my_Page_Url}}" rel="canonical" target="_blank" class="c-article-socials__link twitter-share-button">
  <div class="icon">
     <img th:src="@{/img/icons/social/tw-h.svg}" alt="">
  </div>
</a>

如果打开的图形标记已满,我希望共享预览卡,但是现在它是空的,我可以共享,但没有信息。仅共享按钮中的链接,但没有og前缀信息中的信息

更新 我生成的HTML头代码如下:

<head>
 <meta charset="utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <link href="/css/app.css" rel="stylesheet">
 <title>Статья</title>

 <meta property="og:type" content="website">
 <meta property="og:url"content="https://localhost:8443/articles/instruction/2">
 <meta property="og:title" content="Статья">
 <meta property="og:description" content="DESCRIPTION">
 <meta property="og:image" content="/cmsstatic/img/posts/image_5.png">
</head>

0 个答案:

没有答案