0%

Issues of Setting up Blog

Paltform and Software Tools

  • github, git, node.js, Hexo
  • a domain to tie to github.io, a template for blog

Some Potential Issues

Name

Create a new repo, name it username.github.io, which means first part of the repo has to be the same as your github’s username. for example, burjlizix–burjlizix.github.io.

Edit DNS of Domain

DNS

  • Add first row, host name: @ (or stay blank with google domain); type: A; data: IPv4.
    • ping -4 username.github.io to get IPv4 address.
    • It’s better to add all four IPv4 addresses to avoid the change of IP: 185.199.108~111.153.
  • Add second row, host name: www; type: CNAME; data: username.github.io.
  • Create a CNAME file under ~/source/, add burjlizix.com without www. in the file. Notes: only a file (not .txt or anything else) named CNAME. you can create this file in the following two ways:
    • github: Create a new file in your github repo, fill the information and then download to corresponding local directory.
    • local: create .txt file, show the filename extension and then delete .txt.

node.js

When creating the following two directories ~/nodejs/node_cache/ and ~/nodejs/node_global/, remember to give WIN users permission of full control. It is used to ensure npm install webpack working well.

Useful hexo commands

  • $ hexo clean: cleans the cache file and generate files.
  • $ hexo g or $ hexo generate: generates static files. If there some wrong, it will display error in this step.
  • $ hexo d or $ hexo deploy: deploy your website.
  • $ hexo s or $ hexo server: start a local server. When you need debugging or checking during the process, you can directly use this command instead of above three.

Blog template: NEXT

For the recent version of NEXT, there’s no default local search approach. Here we add this useful function.

  • install package. home directory -> Git Bash.
1
npm install hexo-generator-searchdb --save
  • add the following sentences to ~/_config.yaml file.
1
2
3
4
5
search:
path: search.xml
field: post
format: html
limit: 10000
  • edit "~/themes/next/_config.yml" file and change local search from false to true.

LocalSearch

  • hexo clean+hexo g+hexo d or hexo s to check.

Post images

  • Approach 1 local : Put your images in ~/source/images/, if no, create one. Then, ![image_name](/images/xx.png)

  • Approach 2 web: Get correct image link.
    Take flicker as an example:

    • Update your image to flicker
    • Click and open image, view page source, searchclass="main-photo to find image LINK.

    ImageLink

    • https://LINK.
-------------End of blogThanks for your reading-------------