I wanted to create a simple blog for documentation and how-to tutorials. I would be writing in markup language, as I am using GitHub repositories. I would also like to have automated the posting dates, menus, tags, navigation and have an adapted view for mobile devices.
I will not be thorough, just dot the guidelines and changes I had to make to the references below, due to updated software and my specific Linux host OS (Fedora 23). For additional information, links are provided in each chapter.
To install or update nvm, you should run the install script. To do that, you may either download and run the script manually, or use the following cURL or Wget command:
Once nvm is installed, restart the terminal and run the following command to install Node.js (you can check latest available versions in https://nodejs.org/ but I would recommend to let nvm to automatically select the latest LTS version for you):
1
nvm install --lts
You can check the installed version with nvm current or nvm alias. This is the output:
Once all the requirements are installed, you can install Hexo with npm. Detailed and advanced procedure is explained here: https://hexo.io/docs/#Install-Hexo.
You can modify the files using vi, nano, Hexo commands (https://hexo.io/docs/commands) or any text editor you feel comfortable with.
NOTE: I would recommend Atom or Visual Studio, as they come with a lot of plugins that make life a lot easier.
We start by editing the _config.yml file in the main folder. A description of all the parameters we can change is here: https://hexo.io/docs/configuration.
Some themes may have an example configuration file, so we would start by copying that theme example file to the _config.yml file in the theme folder:
NOTE: Some themes may differ on _config.yml.example file name. Refer to the theme docs. In our case, Icarus’ default theme configuration file is themes/icarus/_config.yml, so there is nothing to do (if you don’t find it, it will be created during deployment).
Now we need to update _config.yml on the project root folder to use newly installed theme. (Don’t get confused with the theme config file on the theme folder).
1
nano _config.yml
We look for the “theme:” attribute and change it. In our case, I will be changing the default theme: landscape for theme: icarus.
This is the aspect of that part of the _config.yml configuration file:
Add the source to the GitHub repository (optional)
Optionally, you might want to maintain a different version of the code, you could make another branch and push the commits there instead of to the default “master” branch.
We will be creating another branch called “source” and pushing there the commits.
As there is no command to delete a post on Hexo, we need to follow this steps :
Delete the post under source/_post folder
(OPTIONAL) Run hexo clean to delete the database (db.json) and assets folder. Make sure to back-up any content that you have posted inside “public” folder as it will be purged as well (for example images).
Run hexo generate to generate the new blog without your deleted post
[barond@fedora barondandi.github.io]$ hexo list post Inferno is in development mode. INFO ======================================= ██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝ ██║██║ ███████║██████╔╝██║ ██║███████╗ ██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║ ██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ============================================= INFO === Checking package dependencies === INFO === Checking the configuration file === INFO === Registering Hexo extensions === INFO Start processing Date Title Path Category Tags 2020-05-08 Hello World _posts/hello-world.md 2020-05-08 Blog on GitHub with Hexo and Icarus theme _posts/install-hexo.md blog Hexo Icarus GitHub
[barond@fedora barondandi.github.io]$ hexo clean Inferno is in development mode. INFO ======================================= ██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝ ██║██║ ███████║██████╔╝██║ ██║███████╗ ██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║ ██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ============================================= INFO === Checking package dependencies === INFO === Checking the configuration file === INFO === Registering Hexo extensions === INFO Deleted database. INFO Deleted public folder.
[barond@fedora barondandi.github.io]$ hexo generate -d Inferno is in development mode. INFO ======================================= ██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝ ██║██║ ███████║██████╔╝██║ ██║███████╗ ██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║ ██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ============================================= INFO === Checking package dependencies === INFO === Checking the configuration file === INFO === Registering Hexo extensions === INFO Start processing INFO Files loaded in 549 ms INFO Generated: content.json INFO Generated: index.html INFO Generated: js/algolia.js INFO Generated: js/insight.js INFO Generated: js/google_cse.js INFO Generated: categories/index.html INFO Generated: archives/index.html INFO Generated: tags/index.html INFO Generated: img/avatar.png INFO Generated: js/animation.js INFO Generated: js/back_to_top.js INFO Generated: js/main.js INFO Generated: img/favicon.svg INFO Generated: img/logo.svg INFO Generated: img/razor-bottom-black.svg INFO Generated: img/razor-top-black.svg INFO Generated: img/og_image.png INFO Generated: img/thumbnail.svg INFO Generated: archives/2020/05/index.html INFO Generated: tags/blog-Hexo-Icarus-GitHub/index.html INFO Generated: archives/2020/index.html INFO Generated: css/cyberpunk.css INFO Generated: css/default.css INFO Generated: css/style.css INFO Generated: 2020/05/08/install-hexo/index.html INFO 25 files generated in 3.76 s INFO Deploying: git INFO Clearing .deploy_git folder... INFO Copying files from public folder... INFO Copying files from extend dirs... [master ccc8f2f] Site updated: 2020-05-08 04:33:28 12 files changed, 105 insertions(+), 106 deletions(-) delete mode 100644 2020/05/08/hello-world/index.html create mode 100644 2020/05/08/install-hexo/index.html rewrite content.json (100%) delete mode 100644 img/avatar.jpg delete mode 100644 img/logo.jpg rewrite index.html (62%) create mode 100644 tags/blog-Hexo-Icarus-GitHub/index.html rewrite tags/index.html (72%) Username for 'https://github.com': barondandi Password for 'https://barondandi@github.com': Enumerating objects: 39, done. Counting objects: 100% (39/39), done. Delta compression using up to 4 threads Compressing objects: 100% (15/15), done. Writing objects: 100% (22/22), 3.04 KiB | 1.01 MiB/s, done. Total 22 (delta 9), reused 0 (delta 0) remote: Resolving deltas: 100% (9/9), completed with 2 local objects. To https://github.com/barondandi/barondandi.github.io.git b76ed22..ccc8f2f HEAD -> master Branch 'master' set up to track remote branch 'master' from 'https://github.com/barondandi/barondandi.github.io.git'. INFO Deploy done: git [barond@fedora barondandi.github.io]$ hexo list post Inferno is in development mode. INFO ======================================= ██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗███████╗ ██║██╔════╝██╔══██╗██╔══██╗██║ ██║██╔════╝ ██║██║ ███████║██████╔╝██║ ██║███████╗ ██║██║ ██╔══██║██╔══██╗██║ ██║╚════██║ ██║╚██████╗██║ ██║██║ ██║╚██████╔╝███████║ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ============================================= INFO === Checking package dependencies === INFO === Checking the configuration file === INFO === Registering Hexo extensions === INFO Start processing Date Title Path Category Tags 2020-05-08 Blog on GitHub with Hexo and Icarus theme _posts/install-hexo.md blog Hexo Icarus GitHub
And this is the aspect of the blog before tinkering!:
3. References and Credits
This document is based on the following resources. I really thank the authors for sharing their knowledge and trouble: