Skip to main content
  1. Posts/

Hello World

·309 words·2 mins
Crabcracker
Author
Crabcracker
A little bit about you

Build on the Local Side
#

Install Hugo (on macOS)
#

brew install hugo
hugo new site quickstart
cd quickstart

Add a Theme
#

git init
git submodule add https://github.com/username/themename.git themes/themename

Copy the config.toml from the theme folder (~/quickstart/themes/theme_name/exampleSite) and paste it in your blog folder. As the original configure file is left empty by default.

hugo new posts/my-first-post.md

Edit the .md file and change the status of “draft” from “true” to “false”.

Build and Test
#

hugo server -D

Open your web broeser and visit “http://localhost:1313” to check if your site works properly.
Press Control+C in Terminal to terminate the hugo server process.


Set on the Gitlab Side
#

  1. Sign up for a Gitlab account.

  2. Go to Settings, following the official guidance to set up your SSH key — generate a pair of keys (passphrase is optional) and upload the public key to Gitlab.

  3. Create a new project.

    (A Gitlab project can be either public or private. If you prefer to prevent others viewing the source code of your blog, you can choose to store it in a private project, which is free for Gitlab free account.)

  4. Follow the offcial guidance to set up Git-related settings and then clone your new project to your computer.

  5. After building and testing on the local side, git push your project back to Gitlab.

  6. Create a new .gitlab-ci.yml file, choose to use a Hugo template and then commit to master branch.

    Now your blog is available at <your_username>.gitlab.io or <your_username>.gitlab.io/<project_name>, which depends on the name of your project. If you’d like the former one, just use “username.gitlab.io” as your project name. If you prefer the latter, set whatever you like for the name of the project.

  7. *Go to project Settings > General, change the Pages visibility from “Only project members” to “Everyone” if you’d like to have a publicly available blog site.