This blog is powered by Hexo which runs on nodejs.
Static site generator vs Dynamic site generator?
Wordpress is a very common example of a dynamic site generator.
A Dynamic site performs many functions apart from just rendering the content. We can do realtime operations like data processing, database operations etc.
Simple blogs often do not require these operations.
Here, static site generators come into picture.
Static site generators after installed can be used to generate simple html-css-js webpages which can be easily uploaded to any online repository.
Examples of ssg include Hexo, Hugo, Jekyll etc.
Hexo uses Node.js. Jekyll uses Ruby. Hugo uses Go. Hugo is the fastest, closely followed by Hexo and then Jekyll. Though Hugo is built with Go, you do not necessarily need to install Golang for it to work. However this is not the case with Jekyll and Hexo. You need to install Ruby for Jekyll and Node.js for Hexo.
HTML pages are generated with hexo using only simple commands like:
1 | hexo init _blogname |
Clone some theme into themes folder and update the same in config.yml in your blogname folder.
For cleaning old generated html files if any. Try this, if webpages are not rendered properly:
1 | hexo clean |
For generating html files which will be gound in public folder in blogname folder:
1 | hexo generate |
For hosting the generated pages into port 4040 of your localhost:
1 | hexo server -p 4040 |
Use a browser to see this and check if everything is rendered completely before uploading to server.
Upload the files in public folder to your site server or git repo.