Jerry Blog维护方法

2025.09.24

新推文

  1. 每篇文章开头,使用yaml格式定义文章的基本信息,格式如下:

    ---
    layout:     post
    title:      "博客维护方法"
    subtitle:   ""
    description: "记录了上传新文章和更新搜索索引的方法"
    date:    2025-09-24
    author:     "黄瑞杰"
    image: "/img/postImg/1.jpg"
    URL: "/allpost/first_commit"
    tags: ["数据结构", "二叉树", "算法"]
    ---
    

    其中,URL需要更改为不同的文件夹,比如second_commit等。因为每个文件夹中只会有一个index.html。

  2. 嵌入视频:

  3. 添加图片:需要将图片放入content的同级目录static中的img,并修改图片相对路径。

    <figure>
       <img src="/img/postImg/2.png" alt="图片走丢了...">
       <figcaption style="font-size:14px; text-align:center; color:gray;">
          图片描述
       </figcaption>
    </figure>
    

    测试:

    图片走丢了...
    图片描述
  4. 高亮

    <mark>高亮</mark>
    
  5. 使用hugo server命令,在本地查看上传后的效果。

  6. 使用hugo命令,在本地构建public文件夹。

  7. 将public文件夹通过git上传到github。

  8. 使用scp -r public/* huang@49.235.32.220:/home/huang/JerryBlog/更新服务器

更新搜索索引

  1. 使用hugo构建public文件夹。
  2. 使用npm run algolia更新algolia平台数据。