PDF version
Please refer to here for a PDF version of this note.
Create a Markdown File
- Write note with Markdown.
Convert the Markdown File to a Local Website
Install hugo and configure the website folder
- Install Hugo following the guidance.
- Install powershell.
- Open
powershell
and change the directory to the location you want to place the website files by runningcd <loc>
. - Create a new site using Hugo by running
hugo new site <site_name>
inpowershell
. - Edit the
hugo.toml
file, leavingbaseURL
empty for now. - Change the directory to the website folder in
powershell
. - Create a document content by running
hugo new docs/test.md
.
Install the theme and add contents
- Run
git init
. - Find a nice theme at Hugo –> Download –> Install (run the
git clone
command under method 1 and rugo n thegit submodule add
command under method 2). - Edit the
hugo.toml
file, addingtheme = <theme_name>
. - Edit the content file, setting
draft
tofalse
and add some contents. - Run
hugo server
and access it locally athttp://localhost:1313/
.
Deploy the Website on Github
Push website framwork to Github
- Create an empty github repository.
- Copy the
git remote add origin <website_path>.git
command. - Add a
README.md
file and git push –>git add README.md
–>git commit -m "initial commit"
–>git branch -M main
–>git remote add origin <website_path>.git
->git push -u origin main
.
Setup a branch for Github pages
- Create a
gh-pages
branch. - Go to repository’s
settings
–>action
–>general
–> enableRead and write permissions
–>save
.
Create a Github workflow
- Create an empty file in your local repository at
.github/workflows/hugo.yml
. - Copy the YML specified in Deploying a Blog Powered by Hugo to Github Pages w/ Custom Domain via Github Actions to the
hugo.yml
file. - Update the Hugo source link,
user.name
, anduser.email
in thehugo.yml
file. - Modify the
hugo.toml
file –>baseURL = 'https://nagato-D.github.io/<repo_name>/'
.
Git push
- Run
git add .
–>git commit -m "add the first test page"
–>git push
. - Waiting for Github to deploy your website.
- Access your website at
https://<user_name>.github.io/<repo_name>/
.
How to Update the Website
- Add (
hugo new <path/filename>
) or modify the markdown files in thecontent
folder (remember to setdraft
keyword tofalse
for markdown files in thecontent
folder). - Run
hugo server
to rebuild the website locally. - Post the website online:
git add .
–>git commit -m "message"
–> git push. - Verify the release.
How to Configure Website
- Copy the contents in
themes/<theme_name>/config.toml
tohugo.toml
. - Modify the parameters specified in
hugo.toml
, such as website title, avatarURL, and social links. - In order to add a menu in the homepage, like the tags in the right top, following the menu setting in the
config.toml
file to configure thehugo.toml
file in the website root directory. - A recommended file structure/organization of the contents can be found here.
- To enable the display of LaTeX-style equations, set
enable = true
under theparams.page.math
item ofhugo.toml
.
Add Icons
LoveIt utilizes the icon library provided by Font Awesome for seamless integration of icons into your content.
Icon references adhere to markdown syntax. To incorporate an icon, simply use the format
:icon_name:
, where the specificicon_name
can be found on the Font Awesome website.As an illustration, let’s say you want to insert a code icon. You can locate the corresponding HTML code here, which is
<i class="fa-solid fa-code"></i>
. Subsequently, you can introduce the code icon using:fa-solid fa-code:
, with thefa-solid fa-code
(namelyicon_name
) derived directly from the HTML code.