Based hugo + github create a personal blog

Based hugo + github create a personal blog

ps: the future of the blog might lose github, and record relocation blog, blog park for some pictures and want to add a markdown of time is less convenient

1. Local test

1.1 Installation

Try to set up a local bar! I use a version of linux deepin

We go to the official website to find the download link on githubhttps://github.com/gohugoio/hugo/releases

I downloaded the 64bit deb package, then installsudo dpkg -i hugo_0.55.6_Linux-64bit.deb

The installation is complete ~

I created a folder in the document, in which there were hugo test

cwl@cwl-PC:~/Documents/blogtest$ pwd
/home/cwl/Documents/blogtest

Initialization blog

cwl@cwl-PC:hugo new site [myblog] "后面的myblog是可选的"

...

cwl@cwl-PC:~/Documents/blogtest$ tree
.
└── myblog
    ├── archetypes
    │   └── default.md
    ├── config.toml
    ├── content
    ├── data
    ├── layouts
    ├── static
    └── themes

In fact, this blog has been up, we need to set a theme

We came to the official theme libraryhttps://themes.gohugo.io/

We just enter a topic, in fact, how use has been very clear

Getting started

Installation

Create a new Hugo site:

$ hugo new site [path]

The this Repository INTO Clone themes/Directory :( note that this is the root of the blog knock clone)

$ cd [path]
$ git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c

Add this line in the config.toml file:

theme = "m10c"

Then we try to start the next

hugo server -t m10c --buildDrafts

And then up.

1.2 write articles

hugo new [path/xxx.md] "简单使用

2. deployed to github repository

First, create a new warehouse, warehouse note name must be [your name .github.io]. For example github named abc. Then writeabc.github.io

The remaining conventional build warehouses is not talked about.

Then knock command

hugo --theme=m10c --baseUrl="Q1143316492.github.io" --buildDrafts

After Qiaowan can see that we have one public folder

cwl@cwl-PC:~/Documents/blogtest/myblog$ hugo --theme=m10c --baseUrl="Q1143316492.github.io" --buildDrafts

                   | EN  
+------------------+----+
  Pages            |  7  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  3  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 10 ms
cwl@cwl-PC:~/Documents/blogtest/myblog$ ls
archetypes  config.toml  content  data  layouts  public  resources  static  themes
cwl@cwl-PC:~/Documents/blogtest/myblog$ ls -l
总用量 36
drwxr-xr-x 2 cwl cwl 4096 6月   8 18:24 archetypes
-rw-r--r-- 1 cwl cwl   82 6月   8 18:24 config.toml
drwxr-xr-x 2 cwl cwl 4096 6月   8 18:24 content
drwxr-xr-x 2 cwl cwl 4096 6月   8 18:24 data
drwxr-xr-x 2 cwl cwl 4096 6月   8 18:24 layouts
drwxr-xr-x 6 cwl cwl 4096 6月   8 18:47 public
drwxr-xr-x 3 cwl cwl 4096 6月   8 18:26 resources
drwxr-xr-x 2 cwl cwl 4096 6月   8 18:24 static
drwxr-xr-x 3 cwl cwl 4096 6月   8 18:26 themes

Now we need it the public folder can be reached above our git


cwl@cwl-PC:~/Documents/blogtest/myblog$ cd public/
cwl@cwl-PC:~/Documents/blogtest/myblog/public$ ls
404.html  avatar.jpg  categories  css  index.html  index.xml  page  sitemap.xml  tags

cwl@cwl-PC:~/Documents/blogtest/myblog/public$ git init
已初始化空的 Git 仓库于 /home/cwl/Documents/blogtest/myblog/public/.git/

cwl@cwl-PC:~/Documents/blogtest/myblog/public$ git add *

cwl@cwl-PC:~/Documents/blogtest/myblog/public$ git commit -m "hugo first submit"


"直接push发现不可以,那就push到master
cwl@cwl-PC:~/Documents/blogtest/myblog/public$ git push
fatal: 当前分支 master 没有对应的上游分支。
为推送当前分支并建立与远程上游的跟踪,使用

    git push --set-upstream origin master

cwl@cwl-PC:~/Documents/blogtest/myblog/public$ git push -u origin master 

Here you can use "abc.github.io" visited, abc your name

to sum up

  • hugo new site [myblog] "后面的myblog是可选的"Initialization blog
  • Then we can download the theme, how to install the theme of the site written very clearly, you can see above me get start
  • hugo server -t m10c --buildDrafts This is open in the local warehouse
  • hugo new post/first.md Write a blog, create a directory md under the context

  • hugo --theme=m10c --baseUrl="Q1143316492.github.io" --buildDrafts This can open a remote repository

    This command in the local blog directory plus a public directory. We just put him can be synchronized to a remote git repository.

    This step only use the personal website github to each user to provide free warehouse provided

emmmmmmmmm, blog can be, but does not seem to gnaw good-looking. . .

I can write markdown lack of a website can easily stick the picture. . .

Guess you like

Origin www.cnblogs.com/Q1143316492/p/10991485.html