Home Website Development
Post
Cancel

Website Development

开发一个和本网站一样的Github page。Using the Jekyll theme Chirpy.

Prerequisites

  1. 首先申请一个github的账号,然后安装以下软件,fork随意。

    Git, Node.js, Ruby, Fork

  2. git主要命令解释。 git fetch: 从远程获取代码库

    git pull: 下载远程代码并合并

    git commit: 提交暂存区到本地仓库

    git push: 上传远程代码并合并

Creating a New Site

  1. 进入这个网站, jekyll-theme-chirpy,然后fork repository。

  2. 回到自己账号里刚才fork的代码的所在地,点setting,把Repository name改成和自己github账号一模一样的名字,再加 “.github.io” 后缀。比如我github账号的名字是cxk,那么名字就改成cxk.github.io.

Customize Your Site

  1. 首先在本地建一个文件夹,名字随便,假设我们命名为gitCode.

  2. 进入你创建的文件夹,右键点击 Git Bash Here, 输入 “git clone https://xxx” 然后执行, https://xxx是你代码库的地址.

  3. 打开cmd, cd进入代码所在文件,执行 “gem install bundler” 命令安装Ruby Bundler.

    安装成功后执行bundle init。最后执行 bundler -v 确认是否安装成功.

  4. 右键点击 Git Bash Here, 执行以下三个命令 one by one:

    “bash tools/init” “npm install -g win-node-env” “npm run build”

    检查是否成功生成文件 “assets/js/dist/”.

  5. 右键点击 Git Bash Here, 输入 “bundle install” 然后执行.

  6. 右键 Git Bash Here, 执行 “bundle exec jekyll s” 命令, 成功执行的话最后一行会是”Server running… press ctrl-c to stop.”

  7. 任意一个浏览器打开 http://127.0.0.1:4000/ , 网站成功出现的话那就可以在本地进行修改了。

  8. 打开你要修改的文件,进行修改后保存,然后刷新第7步的网站,你就能看到你的更改已经生效了。

Deployment

  1. github setting -> Pages -> Build and deployment -> Source要改成GitHub Actions。

  2. config.yml文件里的url修改成 https://username.github.io, username.github.io是你代码库的名字。

  3. commit -> push 你修改后的代码到remote,github就会自动build and deply你的网站,等待一段时间后即可生效。 可从Actions check你的workflow run的状态。

This post is licensed under CC BY 4.0 by the author.

Semiconductor Basic Knowledge

Blogs recommended