现在可以添加自定义侧边栏控件

i18n
xaoxuu 6 years ago
parent c6b80b19ec
commit 5ccecd437d
  1. 13
      _config.yml
  2. 16
      layout/_partial/side.ejs
  3. 10
      layout/_widget/announcement.ejs
  4. 3
      source/less/_widget.less

@ -25,8 +25,12 @@ nav_menu:
icon: fas fa-user
url: https://xaoxuu.com/about/
# 公告的写法示例,这只是个例子哦,需要显示公告的时候写在主目录的config中,不需要的时候注释掉就可以,如果你十分喜欢这个主题,可以把这个公告copy到你那里😄
announcement: '本站使用 <b><a href="https://xaoxuu.com/wiki/material-x/">Material X</a></b> 作为主题,喜欢这个主题的朋友可以阅读文档进行安装哦。'
# 可以添加自定义侧边栏控件,支持的参数如下:
# widgets:
# - icon: fas fa-bullhorn
# title: 注意啦
# body: '本站使用 <b><a href="https://xaoxuu.com/wiki/material-x/">Material X</a></b> 作为主题,喜欢这个主题的朋友可以阅读文档进行安装哦。超喜欢的话还可以安利给身边的朋友哦。'
# url: https://xaoxuu.com/wiki/material-x/
# 友链的写法示例
links:
@ -75,11 +79,6 @@ widgets:
title: false # 是否显示博客名、头衔等等。如果是,需要在主目录的config中写title
motto: false # 是否显示格言座右铭等等。如果是,需要在主目录的config中写motto
social: true # 是否显示社交信息(内容同页脚的社交信息)如果是,需要在主目录的config中写social,支持icon和URL
# 公告,内容写在主目录的config中
announcement:
enable: true
icon: fas fa-bullhorn
title: "公告"
# 显示文章分类
categories:
enable: true

@ -2,8 +2,20 @@
<% if (theme.widgets.author.enable){ %>
<%- partial('../_widget/author') %>
<% } %>
<% if (theme.widgets.categories.enable){ %>
<%- partial('../_widget/announcement') %>
<% if (config.widgets){ %>
<% (config.widgets||[]).forEach(function(item){ %>
<section class='m_widget mywidgets'>
<header class='header <%= theme.style %>'>
<div><i class="<%= item.icon %> fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;<%= item.title %></div>
<% if(item.url) { %>
<a class="rightBtn" target="_blank" rel="external nofollow noopener noreferrer" href="<%= item.url %>"><i class="fas fa-question-circle fa-fw"></i></a>
<%} %>
</header>
<div class='content <%= theme.style %>'>
<%- item.body %>
</div>
</section>
<% }) %>
<% } %>
<% if (theme.widgets.categories.enable){ %>
<%- partial('../_widget/categories') %>

@ -1,10 +0,0 @@
<% if(theme.widgets.announcement.enable == true && config.announcement) { %>
<section class='m_widget announcement'>
<header class='header <%= theme.style %>'>
<div><i class="<%= theme.widgets.announcement.icon %> fa-fw" aria-hidden="true"></i>&nbsp;&nbsp;<%= theme.widgets.announcement.title %></div>
</header>
<div class='content <%= theme.style %>'>
<%- config.announcement %>
</div>
</section>
<% } %>

@ -163,12 +163,13 @@
}
}
.m_widget.announcement{
.m_widget.mywidgets{
.content{
font-size: @fontsize_small;
font-weight: bold;
word-break: break-all;
padding: @gap/2 @gap;
line-height: @fontsize_small + 8px;
&.pure{
padding: 0 @gap @gap @gap; // 适合白色导航栏背景
}

Loading…
Cancel
Save