Skip to content

Commit 9f8c0fa

Browse files
committed
add: 更多符合google结构式化数据的标签
add: dns-prefetch
1 parent cfa98b5 commit 9f8c0fa

File tree

7 files changed

+82
-9
lines changed

7 files changed

+82
-9
lines changed

WebContent/WEB-INF/templates/beetl/yvr/_layout.btl

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88
<meta name="viewport" content="width=device-width, initial-scale=1.0">
99
<meta name="referrer" content="always">
1010
<meta property="qc:admins" content="345615513542636" />
11+
<link rel="dns-prefetch" href="//hm.baidu.com">
12+
<link rel="dns-prefetch" href="//s95.cnzz.com">
13+
<link rel="dns-prefetch" href="${cdnbase}">
1114

1215
<link title="RSS" type="application/rss+xml" rel="alternate" href="${ctxPath}/yvr/rss.xml"/>
1316

1417
<link rel="icon" href="${cdnbase}${base}/rs/logo.png" type="image/x-icon"/>
1518
<link rel="stylesheet" type="text/css" href="${cdnbase}${base}/rs/logo/logo.css"/>
19+
20+
<head itemscope itemtype="http://schema.org/WebSite">
21+
<title itemprop='name'>Nutz社区</title>
22+
<link rel="canonical" href="https://nutz.cn/" itemprop="url">
1623

1724
<!-- style -->
1825
<link rel="stylesheet" type="text/css" href="${cdnbase}${base}/rs/libs/bootstrap/css/bootstrap.css"></link>
@@ -70,7 +77,22 @@ html { overflow-y: scroll; }
7077
<% } else { %>
7178
<title>Nutz社区</title>
7279
<% } %>
73-
<meta name="Keywords" content="Nutz,Nutz是什么,Nutz下载,Nutz论坛"/> <meta name="Description" content="首先,它是开源的,商用也是完全免费的。详尽的文档,众多线上项目 不吹嘘概念,代码严谨可靠,近千个testcase,坚如磐石。您使用的nutz.jar,也是各位提交者在各种生产环境上使用的 nutz.jar ^_^ 一个 jar 包就包含了 Mvc,Ioc,Dao,Aop,不强制依赖第三方 jar。小巧的Lang工具箱和EL表达式引擎,满足各种小需求。内置Json序列..."/>
80+
<meta name="Keywords" content="Nutz,Nutz是什么,Nutz下载,Nutz社区"/>
81+
<% if (null != obj.topic!) { %>
82+
<meta name="Description" content="${submax(obj.topic.content, 50), escape}"/>
83+
<% } else { %>
84+
<meta name="Description" content="它是开源的,商用也是完全免费的。详尽的文档,众多线上项目 不吹嘘概念,代码严谨可靠,近千个testcase,坚如磐石。"/>
85+
<% } %>
86+
87+
<script type="application/ld+json">
88+
{
89+
"@context": "http://schema.org",
90+
"@type": "Organization",
91+
"url": "https://nutz.cn",
92+
"logo": "https://nutz.cn/rs/logo/logo.png"
93+
}
94+
</script>
95+
7496
<meta content="_csrf" name="csrf-param">
7597
<meta content="${obj._csrf!}" name="csrf-token">
7698
</head>

WebContent/WEB-INF/templates/beetl/yvr/_topic.btl

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,21 @@ layout("_layout.btl",{}){
3636
<div id='content'>
3737
<div class='panel'>
3838
<div class='header'>
39-
<ol class='breadcrumb'>
40-
<li><a data-pjax href='${ctxPath}/yvr/list'>主页</a><span class='divider'>/</span></li>
41-
<li class='active'><a data-pjax href='${ctxPath}/yvr/list/${obj.topic.type}'>${obj.topic.type.display}</a></li>
39+
<ol class='breadcrumb' vocab="http://schema.org/" typeof="BreadcrumbList">
40+
<li property="itemListElement" typeof="ListItem">
41+
<a data-pjax href='${ctxPath}/yvr/list' property="item" typeof="WebPage"><span property="name">主页</span></a><span class='divider'>/</span>
42+
</li>
43+
<li class='active' property="itemListElement" typeof="ListItem" >
44+
<a data-pjax href='${ctxPath}/yvr/list/${obj.topic.type}' property="item" typeof="WebPage"><span property="name">${obj.topic.type.display}</span></a>
45+
<meta property="position" content="2">
46+
</li>
4247
</ol>
4348
</div>
49+
<div itemscope itemtype="http://schema.org/NewsArticle">
50+
<meta itemprop="datePublished" content="${obj.topic.createTime, ISO_8601}"/>
51+
<div style="display: none;"><img itemprop="image" src="${ctxPath}/rs/logo/logo.png" alt="NutzCN Logo"/></div>
4452
<div class='header topic_header'>
45-
<span class="topic_full_title">
53+
<span class="topic_full_title" itemprop="headline">
4654
<%
4755
layout("_top_good.btl",{"topic":obj.topic}){}
4856
%>
@@ -84,12 +92,13 @@ layout("_layout.btl",{}){
8492
</div>
8593
<div class='inner topic'>
8694

87-
<div class='topic_content'>
95+
<div class='topic_content' itemprop="articleBody">
8896
<div class="markdown-text">
8997
${markdown(obj.topic.content)}
9098
</div>
9199
</div>
92100
</div>
101+
</div>
93102
</div>
94103
<% if ( null != obj.topic.replies!) { %>
95104
<div class='panel'>

WebContent/WEB-INF/templates/beetl/yvr/index.btl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@ layout("_layout.btl",{}){
88
<div id="content">
99
<div class="panel">
1010
<div class="header">
11+
<ol class='breadcrumb' vocab="http://schema.org/" typeof="BreadcrumbList">
12+
<li property="itemListElement" typeof="ListItem">
13+
<a data-pjax href='${ctxPath}/yvr/list' property="item" typeof="WebPage"><span property="name">主页</span></a><span class='divider'>/</span>
14+
</li>
1115
<% for (topic_type in obj.types) {%>
12-
<a data-pjax href="${ctxPath}/yvr/list/${topic_type}" class="topic-tab ${topic_type == obj.type ? 'current-tab' : '' }">${topic_type.display}</a>
16+
<li property="itemListElement" typeof="ListItem">
17+
<a data-pjax href="${ctxPath}/yvr/list/${topic_type}" property="item" typeof="WebPage" class="topic-tab ${topic_type == obj.type ? 'current-tab' : '' }">${topic_type.display}</a>
18+
</li>
1319
<% } %>
20+
</ol>
1421
</div>
1522
<% if (obj.list.~size > 0) { %>
1623
<div class="inner no-padding">

WebContent/WEB-INF/templates/beetl/yvr/list.btl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<% if ( obj.current_page == 1) { %>
4848
<li class='disabled'><a>«</a></li>
4949
<% } else { %>
50-
<li><a data-pjax href="${request.requestURI}">«</a></li>
50+
<li><a data-pjax href="${ctxPath}/yvr/list/${obj.type}">«</a></li>
5151
<% } %>
5252

5353
<% if ( obj.page_start > 1) { %>

conf/beetl.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ RESOURCE.root= /WEB-INF/templates/beetl
55
RESOURCE.autoCheck= true
66

77
FN.markdown=net.wendal.nutzbook.beetl.MarkdownFunction
8-
FT.escape=net.wendal.nutzbook.beetl.HtmlEscapeFormat
8+
FN.submax=net.wendal.nutzbook.beetl.StringSubMaxFunction
9+
FT.escape=net.wendal.nutzbook.beetl.HtmlEscapeFormat
10+
FT.ISO_8601=net.wendal.nutzbook.beetl.ISO_8601Format
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package net.wendal.nutzbook.beetl;
2+
3+
import java.text.DateFormat;
4+
import java.text.SimpleDateFormat;
5+
import java.util.Date;
6+
7+
import org.beetl.core.Format;
8+
9+
public class ISO_8601Format implements Format {
10+
11+
public Object format(Object data, String pattern) {
12+
Date date = (Date)data;
13+
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
14+
return df.format(date);
15+
}
16+
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package net.wendal.nutzbook.beetl;
2+
3+
import org.beetl.core.Context;
4+
import org.beetl.core.Function;
5+
6+
public class StringSubMaxFunction implements Function {
7+
8+
public Object call(Object[] paras, Context ctx) {
9+
String cnt = (String) paras[0];
10+
int max = ((Number)paras[1]).intValue();
11+
if (cnt.length() <= max)
12+
return cnt;
13+
return cnt.substring(0, max);
14+
}
15+
16+
}

0 commit comments

Comments
 (0)