Files
blog/themes/Ying/layouts/_default/single.html
T

53 lines
2.0 KiB
HTML
Raw Normal View History

2024-07-11 08:59:32 +08:00
{{ define "main" }}
<div id="pjax-container">
2024-07-12 14:55:59 +08:00
<article style="margin-bottom: 3.5em;">
2024-07-11 08:59:32 +08:00
<h1 class="post-title" itemprop="name headline">{{ .Title }}</h1>
<div class="meta">
2024-07-31 16:27:35 +08:00
作者: 小赵同学 浏览: {{ .Params.views }} 字数: {{ .WordCount }} 分类:
2024-07-23 13:47:57 +08:00
{{ range .Params.categories }}
2024-07-31 16:27:35 +08:00
<a href="{{ . }}">{{ . }}</a>
2024-07-23 13:47:57 +08:00
{{ end }}
2024-07-11 08:59:32 +08:00
</div>
<div class="post-content" itemprop="articleBody">
{{ .Content }}
</div>
<div class="post-tags" style="margin-top: -30px;">
<nav class="nav tags">
<ul class="flat">
2024-07-23 13:47:57 +08:00
<!-- 标签内容 -->
2024-07-11 08:59:32 +08:00
</ul>
</nav>
</div>
</article>
2024-07-12 14:55:59 +08:00
<hr class="uk-divider-icon">
2024-07-11 08:59:32 +08:00
<div id="comments" class="comments-area">
<!-- 评论区内容 -->
2024-07-13 15:15:32 +08:00
{{ if or (eq .Type "about") (eq .Type "post") }}
{{ partial "waline.html" . }}
{{ end }}
<!-- 评论区内容结束 -->
2024-07-11 08:59:32 +08:00
</div>
2024-07-13 15:15:32 +08:00
{{/* 文章页面评论弹幕 */}}
2024-07-31 16:20:41 +08:00
<script>
2024-07-31 16:27:35 +08:00
for (let i = 0; i <= 100; i++) {
2024-07-31 16:20:41 +08:00
loadBarrager();
}
function loadBarrager() {
2024-07-12 16:26:14 +08:00
// 获取当前页面的路径
2024-07-13 11:42:38 +08:00
var currentPath = "{{ .RelPermalink }}";
2024-07-31 16:27:35 +08:00
// 只有当 URL 包含 "post" 时才执行弹幕加载逻辑
if (currentPath.includes("post") || currentPath.includes("says")) {
// 调用封装的函数
fetchCommentsAndCreateBarrager(currentPath, {
looper_time: 3000, // 每条弹幕的发送间隔,单位毫秒
defaultAvatar: 'static/default-avatar.png', // 默认头像
defaultInfo: 'No comment', // 默认评论内容
defaultLink: '#', // 默认用户链接
speed: 10, // 弹幕速度,单位秒
});
}
2024-07-31 16:20:41 +08:00
}
2024-07-12 16:26:14 +08:00
</script>
2024-07-11 08:59:32 +08:00
</div>
2024-07-31 16:27:35 +08:00
{{ end }}