[Tools]hugo&github build static website/Baidu statistics

Source: Internet
Author: User
Tags freenom

Hugo/github Building Web Site Fundamentals

    • 1.hugo is a static tool that you write MD, and then he converts MD into a corresponding style of HTML,
    • 2. and HTML embedded in Baidu statistics script. Then you put the HTML on GitHub and GitHub can support a static blog. You have your own blog.
    • 3. User access, trigger JS statistics code, reported to Baidu statistics.
Installation Configuration Hugo+githubpage site

Lao Song wrote a book about this.

Refer to this document has a pit, the URL inside the access changed to HTTPS. If you follow the HTTP of the document, the style load does not succeed after you send it to GitHub.

Download Hugo, is a binary program that has no dependencies

- 将hugo放在可执行路径$ hugo versionHugo Static Site Generator v0.36 windows/amd64 BuildDate: 2018-02-05T15:23:01Z- 新建站点mkdir sitescd siteshugo new site quickstart- 新建文章hugo new posts/ansible常用知识点.md- 下载主题cd themesgit clone https://github.com/halogenica/beautifulhugo.git- 构建hugo server --theme=beautifulhugo --buildDrafts- 本地runhugo server- 构建public静态文件,准备上传htmlhugo --theme=beautifulhugo --baseUrl="https://lannyMa.github.io/"- 新建github,上传代码到github现在github新建仓库: <用户名>.github.io,如我的是lannyMa.github.io- 来到本地,上传代码cd publicecho "# lannyMa.github.io" >> README.mdgit initgit add -Agit commit -m "first commit"git remote add origin https://github.com/lannyMa/lannyMa.github.io.gitgit push -u origin master- 然后访问https://lannyma.github.io/

Hugo Build Environment Template Reference

Deploy later

Each time you write the MD document, you need to build, manual push, this is a great pain, there are deploy.sh.
The right posture is to perform sh deploy.sh "comment a one-click deployment directly

Here I am win7,cmd bad use, I switch to third-party cmder, this execution command compared to Linux.

Deploy.sh is simple, too.

#/bin/bashecho -e "\033[0;32mDeploying updates to GitHub...\033[0m"msg="rebuilding site `date`"if [ $# -eq 1  ]    then msg="$1"figit add -Agit commit -m "$msg"git push origin master# Build the project.hugo # if using a theme, replace by `hugo -t <yourtheme>`hugo-algolia# Go To Public foldercd public# Add algolia search indexgrep -v '"content":' algolia.json>maotai-blog.jsonrm -f algolia.json# Add changes to git.git add -A# Commit changes.git commit -m "$msg"# Push source and build repos.git push origin mastercd ../
Baidu Statistics

This thing can analyze some pv,uv, etc.

Request a free domain name (12 months)

Reference: Free domain and certificate
Freenom.com

Note: The issue of the filing of domain names, if in the country, if the domain name points to the domestic server, you need to record, if the domain name cname to GitHub, then need not.

Maotai.ml This is my site, my cname to Lannyma.github.io.

Todo:

    • Comment Plugin: giment
    • Algolia Search Plugin.
    • Cdn:cloudfare, need to execute the domain name CNAME configuration is OK, freenom.com no way to engage

[Tools]hugo&github build static website/Baidu statistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.