0
我有以下片段。我試圖用開放的圖形標籤來擴展基本片段「頭部」......但是呈現的頁面僅包含片段/頭部的標籤,以及og ones。在Thymeleaf中擴展片段
我怎麼可以添加更多標籤片段?
<head th:include="fragments/head :: head">
<!-- You can use Open Graph tags -->
<meta property="og:url" th:content="${url}" />
<meta property="og:type" content="website" />
<meta property="og:title" content="GUApp" />
<meta property="og:description" th:content="${description}" />
<!--<meta property="og:image" content="http://www.your-domain.com/path/image.jpg" />-->
</head>
<head th:fragment="head" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
....
</head>
它應該根據文檔的作品,BU t ... 無法解析爲片段選擇:「fragments/head :: head(〜{:: meta})」(concorso:4)
< - 您可以使用Open Graph的標籤 - > <元屬性= 「OG:標題」 CONTENT = 「GUApp」/> <元屬性= 「OG:描述」 個:內容= 「$ {描述}」/ > <! - - > – Progeny@Progeny您使用Thymeleaf 2?因爲我覺得靈活的佈局,僅在第3版。如果不能切換,可以試試[參數化的片段簽名(http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#parameterizable-fragment-簽名)並路徑一些'Map <'property','content'>'而不是標籤塊。 – varren