Create a static site with hexo
Hexo is a static site generator, which means it's take content as an input, and generate a site a an output. That's the tool I used to build this site. It's easy to use to build a simple site or blog.
Hexo is a cool static site generator SSG, taking markdown in and generating nice
.html files as an output. It's robust, fast and can be used to replace CMS when you don't need any server side processing.
A static site, is a site where each web pages are available as single a
.html file. Each of which are put on a server and are accessible via http. Those pages are pre-generated once, and served many times. The server does not have much to do, just keep serving those files, no processing applied.
Creating such a site a very high maintenance since you have to make sure each pages match the same template, has the proper links... That's a lot of copy&paste to go through.
That's also why you chose to use a static site generator or SSG. This kind of system generates static
.html files in a specific path using a database and template concepts that you'll find in many CMSs. There's a lot of them, but the popular are Jekyll, Hugo, Metalsmith and Hexo.
Why use one
I also used to love my PHP and or my node.js, but looking back, did I really need all of that to simply serve a blog where the content does not change regularly ? Did I really need an interface to write my article and publish them ? No. Here are some reasons that changed my mind about non-static sites.
Start a runtime, load dependencies, connect to a database, to a cache server, analyze the request, generate the result, compress it, serve it. Those are the actions required for a dynamic site to work. Don't get me wrong, if required, it's a pretty nice and effective way to do things, but it's not as effective as serving a simple file.
A static site does not depends on many things. You need the generator to create the web pages and then you're done. You don't need a huge and complex data base, a specific kind server etc... You simply need to have a simple http server.
A static web site won't return a server error (500) since no processing will be applied to any requests.
Never trust user input, that's the first rule of computing. Since you can't process anything server side, you don't have to worry about this. You still have to manage client related security, but it's also pretty rare to have some.
Why Hexo ?
In all of the existing SSG I could have chosen an other one. I gave a try to multiple of them, but Hexo was easier to use, has a built-in support markdown and already has the plugins that I need to build a site.
It also has a nice number of pre-existing themes, that you can use and customize easily. It's also very easy to create you're own.
After generating you site, you have a directory with your full website in. You just need to upload it to your website host and enjoy the result.
Hexo offers to automatically synchronize those files with different kind of method, including :
Where to use
You can use it to build a site, a blog, a news feed... All kind of site that is data related ans which don't needs to be dynamic or change through time.
The administrator won't have a nice administration panel to edit his articles or pages so it's limited to initiated users who can edit a
.md file and play a few command in the terminal.
hexo serve #Set up a localhost server to ahev a live preview of you writings hexo generate #Generate the final `.html files` hexo publish #Publish them to your hosting service