博客构建记录

本地搭建

  • 在sourceforge上下载hugo的extended版本:hugo_extended_0.92.2_Windows-64bit.zip,解压,并添加到PATH中,记录一个在windows上快捷加环境变量的方法,WIN+R输入sysdm.cpl。

  • 新建站点,新建文章

hugo new site ./myblog
hugo new about.mb # 新建about.md
hugo new post/first.md # 新建post文件夹下的first.md
hugo server -D # 开启本地服务器监听1313端口,包括Draft
hugo -D # 编译网站到public/文件夹下,包括Draft

服务器环境搭建

  • Nginx

    /etc/nginx/conf.d/中新建myblog.conf配置文件,输入

    server {
        listen          80;
        # server_name   windsgo.top; # 如果是ip登录此处不能指定域名
        location / {
                root    /root/git/hugo/;
                index   index.html;
                autoindex on;
        }
        error_log       /root/error.log;
    }
    
  • Git远程仓库和钩子设置

    ~/git/下新建hugo.git/hugo/两个目录,前者作为裸仓用于拉取和推送,建立钩子把后者作为远程仓库存储文件,并用这个目录作为nginx的root目录部署网站。

    cd ~/git/hugo.git/
    git init --bare
    echo "git --work-tree=/root/git/hugo \
    --git-dir=/root/git/hugo.git checkout -f" \
    >>  ~/git/hugo.git/hooks/post-receive
    
  • 在本地添加远程仓库

    # 本地
    cd myblog/public
    git init
    git add .
    git commit -m "first commit"
    git remote add origin root@119.3.100.49:/root/git/hugo.git
    git push -u origin master
    
  • 推送后,在远程仓库中启动或重启nginx服务即可。

    service nginx restart
    

看板娘放置方法

我用的方法其实是挺简单的,功能也比较少,还是懒得搞,主要是利用了pixi.js和pixi-live2d-display两个npm包进行的,我也没有用依赖cdn的方法,我直接把依赖项全部下载到static目录下了。

完成以上配置,看板娘就有啦。

live2d-example