• Hexo is a blog that synchronizes management of multiple computer devices
  • I’ve been having a lot of fun with the Hexo blog; Here is to sort out some of the problems left over before and some personalized configuration
  • If you have any problems setting up your own blog, please refer to my previous two related blogs
    • Build a personal blog based on GitHub and Hexo
    • NexT Theme Configuration Optimization – Unearthed Guide

I. Personalized configuration

1. Return to the top button to display the scrolling progress

  • Open the theme configuration file~themes/next/_config.ymlfindsidebarfield
  • thescrollpercentChange the property oftrueOk, as follows:
sidebar:
# Sidebar Position - the Sidebar Position (only for Pisces | Gemini two styles effectively)
  position: left        // Keep to the left
  #position: right // Position to the right

# Sidebar Display - the Sidebar shows time (only to Muse | Mist two styles effectively)
  #display: post // The default behavior to display when the article page has a list of contents
  display: always       // display it on all pages
  #display: hide // Hide on all pages (can be expanded manually)
  #display: remove completely //

  offset: 12            / / article spacing (only for Pisces | Gemini two styles effectively)

  b2t: false            / / return the top button (only for Pisces | Gemini two styles effectively)

  scrollpercent: true   // Returns the percentage of the top button
Copy the code

Two. Multiple device management blog

Normally, the configuration information of our blog is local and not uploaded to the server, so when we want to reinstall the system on other devices, such as the company computer or the original computer, we can no longer maintain our blog

1. Configure the environment

  • First you need to configure the environment on your computer
    • The installationNode.js
    • The installationgit
    • The installationhexo
  • For details about how to install it, please refer to GitHub and Hexo to build a personal blog

2. Create a branch

  • hexoGenerated static blog files are uploadedGitHubOn, and is placed by defaultmasterBranch, and some related configuration files are local
  • hexoThe source files (deployment environment files) of thehexoBranch (you can create a new onehexoBranch), when replacing a new computer, directlygit clone hexobranch

2-1. Rightusername.github.ioThe new warehousehexobranch

Create a hexo branch in the Github username. Github. IO repository

2-2. Set the default branch

Switch to the hexo branch and set the Default branch to hexo in the repository ->Settings->Branches->Default Branch, save

3. Conduction on the configuration fileGithub

This step needs to be done on the computer where the blog is set up (the computer where the blog profile and theme profile reside)

3 to 1. The cloninghexobranch

  • Will above the newhexoBranch clone to local, in terminalcdAccess to theusername.github.ioFile directory
  • Use in the current directoryGit Bashperformgit branchCommand to view the current branch. It should be a new branchhexo
  • If you useSourcetreeSoftware management code, cloned to local projects may notusername.github.ioAll files are in the root directory, so the operation is not affected. Just remember that the operation is in the root directory of the file
$ git branch
*hexo
Copy the code

3-2. Upload the deployment file

  • Start by putting the local blog’s deployment file (HexoCopy all files in the directoryusername.github.ioFile directory
  • Then install some of the plug-ins you need, some of which you may not need, but all of which seem to have no impact
npm install hexo-generator-index --save
npm install hexo-generator-archive --save
npm install hexo-generator-category --save
npm install hexo-generator-tag --save
npm install hexo-server --save
npm install hexo-deployer-git --save
npm install hexo-deployer-heroku --save
npm install hexo-deployer-rsync --save
npm install hexo-deployer-openshift --save
npm install hexo-renderer-marked@0.2 --save
npm install hexo-renderer-stylus@0.2 --save
npm install hexo-generator-feed@1 --save
npm install hexo-generator-sitemap@1 --save
npm install hexo-generator-search --save
npm install hexo-generator-searchdb --save
Copy the code
  • The last thing is to say that all the documents are submitted tohexobranch
  • Consider the following considerations when submitting
    • Remove the.git directory for the theme within the Themes directory (if there is one) as one Git repository cannot contain another or submitting the theme folder will fail
    • In a different place when the theme needs to be updated latergit cloneDownload the latest version of the theme, and then copy the content to the current theme directory
  • Finally, use terminal or admin tool to submit all files tohexobranch

The Master branch and the Hexo branch each maintain a version. The Master branch is used to store static blog resources and provide blog pages for people to visit. The Hexo branch is used to back up the blog deployment files for its own maintenance and updates, and there is no conflict between the two in a GitHub repository

4. Sync to other computers

  • The generation of a new computerssh keyAdded to theGitHubOn the account
    • ssh keyFor details, seeBuild a personal blog based on GitHub and Hexo
  • Clone on a new computerusername.github.ioThe warehousehexoBranch to local, now localgitThe warehouse is inhexobranch
  • Switch to theusername.github.ioDirectory, executenpm install(Because the warehouse has one.gitignoreFile, which is ignored by defaultnode_modulesFolder, which means warehousehexoThe branch does not store the directory, so it doesinstallBelow)
    • ifnode_modulesIf the file is not lost, do not perform this operation
  • Here you can start blogging on your own computer!
  • It is important to note that every time you update your blog, you should upload the changeshexobranch
  • Every time you change your computer to update your blog, it’s best to do so before you change itgit pullPull up the latest update

Speaking of which, all the relevant issues are basically solved