Hexo博客个性化定制

前言

前段时间给博客换了个域名同时更新了博客的Next主题,最新版的7.1,之前是5.x版本。改动太多就直接clone,然后对照之前的一点点修改吧。这里简单记录一下个性化的设置。

直接在配置文件修改的地方

  1. 网站图标
    favicon:
    将图片定位到/theme/next/source/images
  2. 文章版权
    creative_commons:
    修改post属性为true
  3. 备案
    beian:
  4. 菜单定制
    menu:
  5. 社交
    social:
  6. 友链
    links:
  7. 头像
    avatar:
  8. 阅读全文按钮
    auto_excerpt:
    read_more_btn:
  9. 字符统计信息
    symbols_count_time:
    需要安装插件
    同时根目录配置文件
    symbols_count_time:
  10. 打赏
reward_settings:
enable: true
animation: true
comment: 自定义显示的内容

下面位置放入你的二维码

reward:
wechatpay: /images/wechatpay.jpg
alipay: /images/alipay.jpg
  1. Valine评论系统
# Valine
# You can get your appid and appkey from https://leancloud.cn
# More info available at https://valine.js.org
valine:
  1. 本地搜索
    local_search:
  2. 代码复制按钮
    codeblock:
  3. 阅读人数
    busuanzi_count:

这些都是我自己用到了一下配置,主题配置文件还有很多地方,大家可以去仔细看看

站点根目录配置文件和其他的地方

  1. 汉化
    language: zh-CN 之前版本是zh-Hans 新版本更新了
  2. 网站标题和描述
    title:
    description:
  3. 新建博文时文件名添加当前时间
    new_post_name: :year-:month-:day-:title.md
  4. 添加网站萌宠

https://github.com/xiazeyu/live2d-widget.js
https://l2dwidget.js.org/docs/class/src/index.js~L2Dwidget.html#instance-method-init

  1. 给文章加密
    themes/next/layout/_partials/head/head.swig
    在第5行,也就是第一个if前添加下面代码
<script>
    (function(){
        if('{{ page.password }}'){
            if (prompt('请输入文章密码') !== '{{ page.password }}'){
                alert('密码错误!');
                history.back();
            }
        }
    })();
</script>

然后再文章开头的— ---内添加password: 密码 //记得有空格

  1. 修改全局背景
    /theme/next/source/images目录放入你的背景图片命令为background.jpg
    然后在/theme/next/source/css/_custom/custom.sty中添加下面代码
// Custom styles.
@media screen and (min-width:1200px) {

    body {
    background-image:url(/images/background.jpg);
    background-repeat: no-repeat;
    background-attachment:fixed;
    background-position:50% 50%; 
    background-size:cover
    }

    #footer a {
        color:#eee;
    }
}

暂时就想起来这么多,以后会一点点完善的

关于搭建博客可以看我的另一篇文章这是链接

本人博客链接
https://sxz799.ml

猜你喜欢

转载自blog.csdn.net/u010519914/article/details/89439728