Featured image of post hugo-magic主题使用教程(一) —— 改

hugo-magic主题使用教程(一) —— 改

   
文章摘要
摘要小助理今天溜号啦……😜

前提条件

  • 以下教程以 windows10 为例
  • 操作终端使用 git bash
  • 魔法上网的前提下

下载 hugo

https://github.com/gohugoio/hugo/releases/download/v0.127.0/hugo_extended_0.127.0_windows-amd64.zip
  • 解压到任意目录,然后将目录添加到系统环境变量 如图 (windows)
  • 打开 cmd 输入 hugo version 验证是否设置正确

下载安装 Git

https://github.com/git-for-windows/git/releases/download/v2.45.2.windows.1/Git-2.45.2-64-bit.exe

新建博客

  • 使用 Git bash 终端,打开方式: 桌面右键 找到 Git Bash Here
  • 如果没有魔法上网,git submodule add这一步会拉取失败

后面要使用 shell 脚本,所以需要在系统应用默认处把.sh 文件设置默认 gitbash 打开

在桌面右键打开 Git bash 运行以下命令

hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/woniu336/hugo-magic.git themes/hugo-magic

拷贝文件

拷贝 hugo-magic 主题核心文件到根目录 quickstart

cp -rf themes/hugo-magic/exampleSite/* .
rm hugo.toml
mkdir -p data/summary
mkdir -p assets/img
cp themes/hugo-magic/data/footer_links.json data/
cp themes/hugo-magic/data/summary/summary.json data/summary/
cp -r themes/hugo-magic/archetypes .
cp -r themes/hugo-magic/shell .
cp -r themes/hugo-magic/static .
cp themes/hugo-magic/.gitignore .

启动预览

hugo server -D

打开浏览器,输入地址: http://localhost:1313/

默认的.git 和其他 git 配置文件不要删除,主题 theme 可以把.git 文件夹删除,防止跳转到原作者仓库

CC BY-NC-SA 4.0 创意的非商业派对入场券
最后更新于 2024-12-23 10:06
晚来天欲雪,能饮一杯无