博客设计总结

Hexo

Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。

Hexo所用到的工具有:git、node.js,具体搭建可以参考:hexo史上最全搭建教程_zjufangzh的博客-CSDN博客

此次选择的是Butterfly模板,安装方式可参考:Butterfly 安裝文檔(一) 快速開始 | Butterfly

构建流程

​ 在已经构建好基础的博客以后,里面的要么就是默认空博客,要么就是别人之前已经设置好的,此时我们需要将整体环境进行优化,并将内容替换为自己的。Hexo 支持直接将 markdown文件进行部署,因此创建新文章的时候,只需要编写markdown文件即可。

图片插入

​ 因为在博客上的图片链接是拼接的形式,因此只需要提供相对地址就行,参照下面的文件夹路径,从年份文件夹开始,如:2023/05/05/test/img/image_insert_.png

image_insert

markdown基础设置

​ 可以在 _config.yml 文件中修改以下站点上设置:

Setting Description
title The title of your website
subtitle The subtitle of your website
description The description of your website
keywords The keywords of your website. Supports multiple values.
author Your name
language The language of your website. Use a 2-letter ISO-639-1 code or optionally its variant. Default is en.
timezone The timezone of your website. Hexo uses the setting on your computer by default. You can find the list of available timezones here. Some examples are America/New_York, Japan, and UTC.

​ 以下是本人的站点设置:

1
2
3
4
5
6
7
title: Hannah's Blog
subtitle: CJY de personnal blog
description: This blog is divided into three main sections:pouring recommendations about animated films, DaSE homework-related content, and other bits and pieces.
keywords: DaSE, Annimation
author: Hannah Chou
language: en
timezone: ''

其他搭建好后的优化建议参考该博客:[【Hexo】Hexo搭建Butterfly主题并快速美化_CoolTiger_程序员的博客-CSDN博客](https://blog.csdn.net/mjh1667002013/article/details/129290903?ops_request_misc=&request_id=&biz_id=102&utm_term=修改hexo butterfly&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-3-129290903.142^v88^control_2,239^v2^insert_chatgpt&spm=1018.2226.3001.4187)

问题与解决

  1. 一开始使用了jekyll,有一个deadly error,不知道怎么解决:下载jekyll-theme-prologue的时候bundller的版本不兼容,尝试了很多次,也换了gem的下载版本,但是还是不行。

1

希望有大佬可以指点迷津。

  1. git clone有时候连接不上(这个看缘分,vpn多刷新一下)

2

  1. hexo操作代码:

    1
    2
    3
    4
    5
    6
    7
    git clone -b master <你看中的模板的github url>
    ---加入你自己的md文件以后---
    hexo clean
    hexo g
    hexo d
    hexo h
    hexo server (本地查看)
  2. 事实上,每次上传,都是上传Blog文件夹下的public文件夹,因此,需要修改的话,代码全都在public文件夹中,修改public就可以了。

  3. 每次在添加markdown文件时,重新 hexo clean 的话会将代码全部格式化,因此后续可以只hexo g和hexo d,这点很重要!

心得

​ 我简单实现了一个个人博客,通过选择Hexo中喜欢的模板,跟随github代码仓库下的instructions,部署好了一个简单的模板。再自己编写md文件,放在source\_posts\下,以此生成自己的博客,受益匪浅!