✨ feat: boardcast
This commit is contained in:
parent
c775133f5b
commit
83b79e97c1
@ -121,6 +121,12 @@ cover:
|
|||||||
# ProgressBar
|
# ProgressBar
|
||||||
progressBar: true
|
progressBar: true
|
||||||
|
|
||||||
|
# Boardcast
|
||||||
|
broadcast:
|
||||||
|
enable: true
|
||||||
|
type: 2 # 1:custom,2:hitokoto api(https://hitokoto.cn/)
|
||||||
|
text: a clean and elegant theme, fast and responsive. # only work in custom mode
|
||||||
|
|
||||||
# Article Setting
|
# Article Setting
|
||||||
# (Use this to excerpt if article is too long:<!--more-->)
|
# (Use this to excerpt if article is too long:<!--more-->)
|
||||||
excerpt_link: Read More...
|
excerpt_link: Read More...
|
||||||
|
@ -35,6 +35,12 @@ cover:
|
|||||||
# 页面顶部进度条
|
# 页面顶部进度条
|
||||||
progressBar: true
|
progressBar: true
|
||||||
|
|
||||||
|
# 告示板模块
|
||||||
|
broadcast:
|
||||||
|
enable: true # true开启,false关闭
|
||||||
|
type: 2 # 1:自定义输入,2:一言api(https://hitokoto.cn/)
|
||||||
|
text: 一个安静优雅的hexo主题,快速且响应式。 # type为1时有效
|
||||||
|
|
||||||
# 文章配置
|
# 文章配置
|
||||||
# 文章太长,截断按钮文字(在需要截断的行增加此标记:<!--more-->)
|
# 文章太长,截断按钮文字(在需要截断的行增加此标记:<!--more-->)
|
||||||
excerpt_link: 阅读更多...
|
excerpt_link: 阅读更多...
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<section class="outer">
|
<section class="outer">
|
||||||
|
<% if (theme.broadcast.enable && pagination == 2){ %>
|
||||||
|
<%- partial('_partial/broadcast') %>
|
||||||
|
<% } %>
|
||||||
<article class="articles">
|
<article class="articles">
|
||||||
<%
|
<%
|
||||||
var title = '';
|
var title = '';
|
||||||
|
46
layout/_partial/broadcast.ejs
Normal file
46
layout/_partial/broadcast.ejs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<% if (theme.broadcast.type===1 && theme.broadcast.text){ %>
|
||||||
|
<div class="notice" style="margin-top:50px">
|
||||||
|
<i class="ri-heart-fill"></i>
|
||||||
|
<div class="notice-content"><%= theme.broadcast.text %></div>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
<% if (theme.broadcast.type===2){ %>
|
||||||
|
<div class="notice" style="margin-top:50px">
|
||||||
|
<i class="ri-heart-fill"></i>
|
||||||
|
<div class="notice-content" id="broad"></div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
fetch('https://v1.hitokoto.cn')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
document.getElementById("broad").innerHTML = data.hitokoto;
|
||||||
|
})
|
||||||
|
.catch(console.error)
|
||||||
|
</script>
|
||||||
|
<% } %>
|
||||||
|
<style>
|
||||||
|
.notice {
|
||||||
|
padding: 20px;
|
||||||
|
border: 1px dashed #e6e6e6;
|
||||||
|
color: #969696;
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
background: #fbfbfb50;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice i {
|
||||||
|
float: left;
|
||||||
|
color: #999;
|
||||||
|
font-size: 16px;
|
||||||
|
padding-right: 10px;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-top: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice-content {
|
||||||
|
display: initial;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user