备忘录
修改Pug模板/blog/blog/themes/butterfly/layout/includes/header
为了能够正确地处理 _config.yml 中的数据,稍微调整一下 Pug 模板中的循环部分。
each socialItem in theme.social
a.social-icon(href=url_for(trim(socialItem[1])) target="_blank"
title=socialItem[2] === undefined ? '' : trim(socialItem[2]))
i(class=socialItem[0] style=socialItem[3] === undefined ? '' : `color: ${trim(socialItem[3]).replace(/[\'\"]/g, '')};`)
Social Settings (社交图标设置)
social:
- [fab fa-github, https://github.com/yourusername, Github, '#24292e']
- [fab fa-bilibili, https://bilibili.com/, Bilibili, '#FA7298']
调试步骤 保存文件:确保您已将这些更改保存到 _config.yml 和 Pug 模板文件中。 清理并生成:运行 hexo clean 清理缓存,然后运行 hexo g 生成静态文件。 启动服务器:运行 hexo s 启动本地服务器来预览网站。
设置文章优先级
1:下载插件
npm uninstall hexo-generator-index --save
npm install hexo-generator-index-pin-top --save
2:设置文章的优先级 /source/_posts/(要修改编辑的博客)
然后打开了这篇博客,加上top属性,top后面数字越大优先级越大
---
layout: '[layout]'
title: 备忘录
date: 2024-07-26 16:12:19
tags:
top: 1
---
Butterfly 添加全局吸底 Aplayer
卸载 hexo-tag-aplayer 插件
在Hexo站点根目录执行以下卸载hexo-tag-aplayer命令,使用 CDN 的方式引入
npm un hexo-tag-aplayer
# Inject the css and script (aplayer/meting)
aplayerInject:
enable: true
per_page: true# Inject
# Insert the code to head (before '</head>' tag) and the bottom (before '</body>' tag)
# 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject:
bottom:
- <div class="aplayer no-destroy" data-id="8932390" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="false" data-order="random" data-volume="0.3" data-mutex="true" data-listMaxHeight="36vh"> </div>
Hexo-admonition
安装插件
npm install hexo-admonition --save
>这里嵌套一行引用信息。
<div class="admonition note"><p class="admonition-title">Hexo-admonition 插件使用示例 </p><p>这是基于 hexo-admonition 插件渲染的一条提示信息。类型为 note,并设置了自定义标题。</p> <p>提示内容开头留 4 个空格,可以有多行,最后用空行结束此标记。</p> </div>
<div class="admonition warning"><p class="admonition-title">warning</p><p>这是一条采用默认标题的警告信息。</p> </div>
<div class="admonition warning"><p>这是一条不带标题的警告信息。</p> </div>
这里是提示内容。
这里是警告内容。
这里是错误内容。
<div class="admonition warning"><p>这是一条不带标题的警告信息。</p> </div>