);
$cookie = implode(',', $cookie);
Typecho_Cookie::set('contents_views', $cookie);
}
}
echo $exist == 0 ? ' 暂无阅读' :$exist.' 人浏览';
}
# 调用方式。我是用的 Jasmine 主题,所以文章浏览页面是 middle-single.php,添加代码(大约在35行左右)
# 这个页面是必加的,否则不能实现计数功能。其他页面还需调用则添加同样代码
# 查看所有文章概况时,也可添加上 (default-item.php)
<!-- 添加页面浏览次数统计 -->
<span class="middotDivider"></span>
<span><?php Postviews($this); ?></span>
添加友链功能
# 添加友链独立页面 link.html,粘贴如下代码
<table>
<div class="post-body">
<div id="links">
<div class="links-content">
<div class="link-navigation">
<div class="card">
<img class="ava" src="https://cdn.jsdelivr.net/gh/hvnobug/assets/common/avatar.png" />
<div class="card-header">
<div>
<a href="https://blog.hvnobug.com/">Emil’s blog</a>
</div>
<div class="info">这是一个分享IT技术的小站。</div>
</div>
</div>
<div class="card">
<img class="ava" src="https://blog-images-1301001018.cos.ap-beijing.myqcloud.com/favicon.png" />
<div class="card-header">
<div>
<a href="https://yingwiki.top">越行勤's Blog</a>
</div>
<div class="info">努力学习的小菜鸟</div>
</div>
</div>
</div>
</div>
</div>
</div>
</table>
# 主图外观中,左边菜单栏添加如下代码
{
"name": "友链",
"icon": "bi bi-people-fill",
"url": "/link.html",
"newTab": false
}
# 主图外观中,自定义样式添加如下代码
.links-content {
margin-top: 1rem
}
.link-navigation::after {
content: " ";
display: block;
clear: both
}
.card {
width: 45%;
font-size: 1rem;
padding: 10px 30px;
border-radius: 4px;
transition-duration: 0.15s;
margin-bottom: 1rem;
display: flex;
border-style:none;
}
.card:nth-child(odd) {
float: left
}
.card:nth-child(even) {
/* float: right */
}
.card:hover {
transform: scale(1.1);
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04)
}
.card a {
border: none
}
.card .ava {
width: 3rem !important;
height: 3rem !important;
margin: 0 !important;
margin-right: 1em !important;
border-radius: 4px
}
.card .card-header {
font-style: italic;
overflow: hidden;
width: 100%
}
.card .card-header a {
font-style: normal;
color: #2bbc8a;
font-weight: bold;
text-decoration: none
}
.card .card-header a:hover {
color: #d480aa;
text-decoration: none
}
.card .card-header .info {
font-style: normal;
color: #a3a3a3;
font-size: 14px;
min-width: 0;
overflow: hidden;
white-space: nowrap
}
# 以后每次添加友链复制一份,手动修改内容
# 名称 {name}
# 链接 {link}
# 头像 {avatarurl}
# 简介 {description}
<div class="card">
<img class="ava" src="{avatarurl}" />
<div class="card-header">
<div>
<a href="{link}">{name}</a>
</div>
<div class="info">{description}</div>
</div>
</div>
手动配置SSL,并使用域名访问
如果在安装Typecho应用模版前,没有购买域名、备案、申请SSL,通过以下内容,手动配置。