Who doesn't want to own their own blog site?

Posted by austingecko on Sun, 19 Dec 2021 00:14:31 +0100

#Benefits of having a personal blog site

  • Send what you want, not afraid to be audited
  • The website style is transformed by itself. You can show off as cool as you want
  • Lucky enough to be big enough to undertake advertising
  • Have a small world of your own
  • ...

Now let's take a look at how to build a blog website, taking hugo as an example.
First, let's talk about the advantages of hugo. It is written in go language, and the response speed is very fast. The blog content supports the mainstream markdown format.

#Download hugo software

https://github.com/gohugoio/hugo/releases

My environment is centos7 64 bit, so I choose hugo_0.87.0_Linux-64bit.tar.gz
If you think github download is slow, I saved chinacode for you, https://codechina.csdn.net/lyndon_li/hugo_linux_64/-/tree/master/ , you can download it here quickly.

#Decompression deployment

The deployment is very simple because it is a binary program. We just need to put it in the / usr/local/bin / directory. Or put it in any directory and add environment variables.

$ tar xvf hugo_0.87.0_Linux-64bit.tar.gz -C hugo
$ cd hugo
$ cp hugo /usr/local/bin/

#Create blog site directory

You don't need to use mkdir to create it. Just execute the following command to create it automatically

hugo new site hugoblog

This creates a blog site directory, Hugo blog /, and generates the necessary configuration files and directories.

[root@Box ~]# tree hugoblog/
hugoblog/
├── archetypes
│   └── default.md
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes

config.toml: configuration file
Content: the content of the website. The post directory under it is the directory where we store blog articles. The articles are in markdown format. A file is a blog article. Writing and management are very convenient.
static: store media files, which can be accessed directly by URL. It can even be used as a gallery. All the pictures in my blog posts are stored here.
Themes: store third-party themes. A directory is a theme

#Download theme

I use The snow is merciless The theme maupassant developed by the great God, you can visit his website to see the effect, but there are many advertisements on the website. It is estimated that the great God has received many advertisements and is envious

$ cd themes/
$ git clone https://gitee.com/lyndon2/maupassant-hugo.git
$ mv maupassant-hugo/ maupassant

#Modify profile

This is the configuration file I have been using. You can increase or decrease it according to your actual situation

[root@Box hugoblog]# cat config.toml
languageCode = "en-us"
title = "Lyndon's Blog"
theme = "maupassant"

summaryLength = 70
hasCJKLanguage = true

#Keep the original name of the category (false will be converted to lowercase)
preserveTaxonomyNames = true

[author]
        name = "Lyndon"

[params]
        localSearch = true
        author = "Lyndon"
        #busuanzi = true

[menu]
        [[menu.main]]
                identifier = "about"
                name = "about"
                url = "/about/"
                weight = 4
        [[menu.main]]
                identifier = "archives"
                name = "file"
                url = "/archives/"
                weight = 3

[markup]
        [markup.highlight]
                #lineNos = true
                #style = "github"
                #style = "monokai"
                #style = "solarized-light"
                style = "monokailight"

[params.utteranc]
    enable = true
    repo = "liyongjun123/hugo-blog-issue"    # Repo for storing comments in the format of owner/repo
    issueTerm = "pathname"  #It means that you choose to associate the comments of github issue with your article in that way.
    theme = "github-light" # There are two styles and themes, GitHub light and GitHub dark

#Run

hugo server -w --baseURL=http://192.168.1.29:8088 --bind=0.0.0.0 --port=8088

#Browser access

#Display

This is a personal blog website I built a year ago, link , I prefer a simple style, but there should be some functions, such as message function.

So far, I have published nearly 300 articles on it, which is very helpful for my study, sorting and summary.

I hope you can also have your own blog website.

Topics: Web Development Linux Operation & Maintenance