Wechat search search [Java Finance] reply [666] to get the BAT interview clearance manual for free

The introduction

Last week, a friend asked me if I had a personal blog and wanted to exchange a friend chain with me. I’ve thought about starting my own blog before, but I have been slow to do so. I usually write articles and send them to other platforms. I thought why I didn’t build a blog of my own? On the one hand, may be troublesome, need to go to their own blog platform to publish, usually some third party blog platform is too lazy to send, two to buy a server and domain name general configuration a year also have several hundred oceans. So I have not set up a blog of my own. However, in the era of “we media”, many programmers have their own blogs or personal websites. The establishment of such sites can help us record our life and make personal presentations, as well as help us expand our social circle and make friends with others. In the process of continuous writing, I can force myself to do mental mining, let myself know more about the unknown world, and open up my mind. So I thought I’d make one.

Selection of blog sites

Nowadays, blogging is mostly in the Markdown format, and most major blogging sites support this format, so you can write a post and copy it everywhere. Now generally speaking commonly used blogs can be divided into two categories: dynamic and static blog sites.

Static blog

Static blogs are typically generated from markdown files and then some other program that generates HTML files and publishes the HTML files to the service. You can generate static blogs using frameworks like Hexo, Jekyll, etc. We can publish the generated HTML to third-party servers such as Github, Gitee, Coding, etc. These servers can be used for nothing. Then you can customize your own domain name.

Dynamic blog

Dynamic website refers to the content of articles and other data stored in a database. This kind of play is relatively high, suitable for like to toss, like DIY partners. WordPress is a mature solution for building dynamic websites, and it is a classic blog platform. And the ecosystem is relatively complete, there are a lot of plug-ins and blog themes for us to choose, high freedom. But tell the truth dynamic blog words tell the truth a little trouble, need oneself to buy domain name and server, database, saw the worst configuration basically want nearly 100 dollars a year. I chose a static blog for my own situation, and after a lot of Google searching I settled on Hexo, which is a fast, simple, and efficient blogging framework. Hexo uses Markdown (or another rendering engine) to parse articles and, in seconds, generate static web pages with beautiful themes to build his own blog site. Words not much we still enter today’s theme of hand – in – hand to build a blog site belonging to their own.

Set up steps

  1. Install Git. I won’t go into detail about this. By default, most programmers know how to install Git. If you’ve used it, check out my previous post about Git and Github in 10 Minutes.
  2. Install NodeJs becauseHexoIs based onnodeJsEnvironment, so this nodejs must be installed,Download address(note:LTSFor the long-term support version,CurrentAs a programmer you are sure to download the latest version to install. I’m no exception, but my computer iswin7The system, the latest version actually can not install, this is a bit too much, actually look down onwin7, the installation is not supported

Weak weak ask next to use win7 system now many people? You can only re-download a long-term version. There is nothing wrong with this version, just click on the next step until the installation is complete. Check the version below:node -v

3. Install Hexo. To install hexo, run the NPN command. The download speed of NPM default source may be very slow, so it is recommended to use Taobao image instead. Execute the following command to set the source of NPM as taobao mirror site. Just like we download jar for Maven, we will generally change the central warehouse to Ali.

npm config set registry "https://registry.npm.taobao.org"
Copy the code

Install hexo

npm install hexo-cli -g
Copy the code

Initialize hexo

hexo init
Copy the code

Initialize we can see the following files generated in our directoryNode_modules: is a dependency package public: stores the generated pages. Scaffolds: template with the command to generate articles, etc. Source: various articles themes created with the command. Json: the configuration information of the module project required by the project. Next, install the dependency files required for the blog

npm install 
Copy the code

Next in the execution

hexo g & hexo s
Copy the code

At this point the whole blog is published and we type in the browserhttp://localhost:4000/You can see one of our blog interfaces:We can see that the whole blog page is still relatively concise and not very rich content. We can follow our own preferences and then go to the Internet to find a blog theme that we like, I went through a lot of screening. This adaptive theme was chosenhexo-theme-matery, and support messages and comments and search. How do you apply this theme? It’s easy to take the topic directly from GitcloneLet’s go down and put it in oursthemesdirectoryThen go back to the root directory of hexo and modify the _config.yml fileSo that’s our theme replacement. Can see the effect after I replace, welcome the big guy message to exchange friend chain. Access Address:https://javajr.cn/You can also click to read the original article.PCSide effects

H5The effect4. Release togithubandgiteeAfter the above steps we based on a local blog has been completed, but this is far from enough, we need to be able to access the external network, generally we need to buy their own servers, butgithubCloud and yardsgiteeThey provide us with a free server to host our static web site on. Now let’s start withgiteeCreate a repository for exampleAnd then I’m gonna put the address of this warehousecopytohexoIn the configuration file in the root directoryThe local directory to be published togiteeYou need to perform

npm install hexo-deployer-git --save
Copy the code

And then we execute

hexo clean & hexo g & hexo d
Copy the code

And then we can seegiteeWe have a static blog on the InternetAnd then we click on Update deploymentgiteeWill help us generate an extranet accessible websiteIsn’t it super simplegithubI’m not going to show you something like that. At this point we have completed an extranet accessible blog.

Integrated comments

What I used wasGitalkThe comment module is often used when integrating this moduleError: Network ErrorThis error

There are two main reasons for this mistake: one is domesticgithubNetwork speed problems caused by timeout, and another word is when we are in the configuration filegitalk#repoThis property is nothttpThe beginning of the warehouse address, as long as the name of the warehouse can be written.All the keys on it are fakeOAuth ApplicationWhen the.

Custom domain name binding (javajr.cn)

This needs to buy a domain name and then real name authentication, the next is the resolution of the next can, HERE I take Ali Cloud as an example:giteeCustom domain names are no longer supported. butgithubYes. We go to where we’re deployedgithubBlog repository clicksettingButton (drag it down hard, this setting is at the bottom of the comparison page) to update our domain name.So we can use our domain name (javajr.cnTo access the

conclusion

Basically in half an hour or so we can finish a blog that can be accessed from the Internet oh. There are someseoOptimization, or let Baidu included, I submitted for a long time Google and Baidu does not seem to be included. The time that says Baidu collects on the net is quite long. If there is an opportunity to be included in the future to add next.