About

December 6, 2018

1. Introduction

转眼即逝,我在Sun Yat-sen University的四年大学生活即将走到尽头,即将迎来的是我在Peking University的三年研究生活,研究方向是Computer Vision && Deep Learning。在本科阶段我就有写博客的习惯,所以研究生阶段,我会继续保持写博客的习惯。

islinwh.github.io是我用hugo生成,并托管在GitPage的个人主页。这篇文章我将记录我对个人主页大大小小的改进,以便我个人的查阅,同时如果你喜欢我的主页风格,这篇文章也可以作为你搭建个人主页的入门教程。

2. Process

2.1 Enviroment

2.2 Installation

使用homebrew安装hugo

brew install hugo

2.3 Build

使用hugo快速生成站点

$ cd Document/
$ hugo new site blog

初始化仓库

$ cd blog/
$ git init

Hugo Theme选择合适的主题,我选的是Minimal,将它git submoduletheme文件夹

$ git submodule add https://github.com/calintat/minimal.git themes/minimal
$ git submodule init
$ git submodule update

以后更新主题的指令如下

$ git submodule update --remote themes/minimal

安装完成后,将主题的配置文件config.toml复制一份到blog目录下

$ cp themes/minimal/exampleSite/config.toml .

然后就是修改config.toml文件, 我修改的内容有:

baseURL = "https://islinwh.github.io/"
languageCode = "en-us"
title = "Linwh"
theme = "minimal"
disqusShortname = "username" # delete this to disable disqus comments
googleAnalytics = ""

[params]
    author = "Linwh"
    description = "A software engineering student is Sun Yat-sen University\n\n #ComputerVision\n\n#DeepLearning"
    githubUsername = "#islinwh"
    accent = "red"
    showBorder = true
    backgroundColor = "white"
    font = "Raleway" # should match the name on Google Fonts!
    highlight = true
    highlightStyle = "solarized-dark"
    highlightLanguages = ["go", "haskell", "kotlin", "scala", "swift"]

[[menu.main]]
    url = "/"
    name = "Home"
    weight = 1

[[menu.main]]
    url = "/post/"
    name = "Posts"
    weight = 2

[[menu.main]]
    url = "/project/"
    name = "Projects"
    weight = 3

[[menu.main]]
    url = "/CV/"
    name = "CV"
    weight = 4

[[menu.main]]
    url = "/About/"
    name = "About"
    weight = 5

# Social icons to be shown on the right-hand side of the navigation bar
# The "name" field should match the name of the icon to be used
# The list of available icons can be found at http://fontawesome.io/icons/

[[menu.icon]]
    url = "mailto:islinwh@outlook.com"
    name = "envelope-o"
    weight = 1

[[menu.icon]]
    url = "https://github.com/islinwh"
    name = "github"
    weight = 2

启动server,在localhost:1313查看主页效果(由于hugo会检测文件变化实时更新,可以直接修改看效果):

$ hugo server -D

制作完成后,调用hogo,生成静态网页至public文件夹,将public/下的文件复制到islinwh.github.io/,直接覆盖原文件夹下文件,然后push到仓库

$ git add .
$ git commit -m "Initialize blog"
$ git push origin master

在浏览器输入islinwh.github.io就可以看到个人主页了。

3. Debug

在搭建个人主页的过程中,还是有遇到些问题的:

3.1 本地显示正常,但在gitpage上样式错乱

根本原因便是没有读取到css文件。最终发现原因在于baseURL = "https://islinwh.github.io/"中https打成http。

####3.2 编写博文后,调用hugo并没有生成新的文件

将博文头部draft=true去掉便可。

4. Advance

comments powered by Disqus