knowledge

  • The basic function
  • Github pages
  • Automated deployment
  • Editing articles online

Using hexo

  • npm install hexo-cli -g
  • hexo init blog-aking
  • cd blog-aking
  • npm install
  • hexo server

Modify the config

  • The title
  • The author
  • Chinese useful – CN

Replace the topic

  • Clone the theme to the Themes folder
  • Use the downloaded theme cactus in the home directory
  • Its own _config colorscheme white

Deploy to GitHub

  • Github deploys the site in two ways
    • https://[username].github. IO repository name must be [username].github.
    • https://[username].github. IO /[repo] You can customize the repository name to package product gh-Pages branch (open source project, work or demo presentation)
  • Wanting to install the yarn Add hexo-deployer-git dependency will help us deploy the code to a specific branch. Then drag the config file in the root directory to the bottom
Type :git repo: project address branch:masterCopy the code

Then we run NPM run deploy to run our code and the code is committed to our remote repository which is a file in the public directory

  • Settings finds a column under Pages that shows our site weiaiking.github. IO /

Automatic deployment

  • First submit the source code to Github, the master is already occupied, we submit to the new branch
  • Create and switch branches git checkout -b akingblog
  • Git add. Git commit -m “git push –set-upstream origin akingblog
  • Github actions and Settings are in a row. The actions function is to help you build test deployments and also do code review branch management
  • In the project to create a yml on. Making/workflows/deploy. Yml
  • Then submit the code to the AkingBlog branch

Online editing

  • The deployment will also be triggered after the submission
  • According to GitHub online’s rules for changing urls, we can add jump buttons to makeDowns
  • Go to the theme’s template file Layout /post.ejs to add an edit button
  <div>
    <a href="https://github.com/WeiaiKing/weiaiking.github.io/edit/akingblog/source/<%- page.source %>"
      target="_blank">The editor</a>
  </div>
Copy the code