Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Prerequisites
In order to use this theme you must have installed hexo.
Create the
root
directory for the blog by initializing it with hexo:
1 | $ hexo init my-blog |
- Navigate into the new directory:
1 | $ cd my-blog |
Install
- In the
root
directory:
1 | $ git clone https://github.com/probberechts/hexo-theme-cactus.git themes/cactus |
- Change the
theme
property in the_config.yml
file.
1 | # theme: landscape |
See below for more information on how to customize this theme.
- Create pages and articles with the
hexo new [layout] <title>
command.
For example, to create an “about me” page, run:
1 | $ hexo new page about |
This will create a new file in source/about/index.md
Similarly, you can create a new article with
1 | $ hexo new post "hello world" |
and add some interesting content in source/_posts/hello-world.md
.
Run:
hexo generate
andhexo server
Configuration
You can (and should) modify a couple of settings. An overview of all settings
can be found in _config.yml. The most important ones are
discussed below.
There are two possible methods to override the defaults. As a first option,
you could fork the theme and maintain a custom branch with your settings.
Alternatively, you can configure it from your site’s primary configuration
file. Therefore, define your custom settings under the theme_config
variable.
For example:
1 | # _config.yml |
1 | # themes/cactus/_config.yml |
This will override the default black colorscheme in themes/cactus/_config.yml
.
Color scheme
Currently, this theme is delivered with four color schemes: dark, light,
white and classic. Set your preferred color scheme in the _config.yml
file.
1 | colorscheme: light |
Alternatively, you can easily create your own color scheme by creating a new
file in source/css/_colors
.
Navigation
Set up the navigation menu in the _config.yml
:
1 | nav: |
Blog posts list on home page
You have two options for the list of blog posts on the home page:
- Show only the 5 most recent posts (default)
1 | posts_overview: |
- Show all posts
1 | posts_overview: |
Projects list
Create a projects file source/_data/projects.json
to show a list of your projects on the index page.
1 | [ |
Social media links
Cactus can automatically add links to your social media accounts.
Therefore, update the theme’s _config.yml
:
1 | social_links: |
where NAME
is the name of a Font Awesome icon.
Copyright years
By default, Cactus will use current year in your copyright year information.
If there is a need to customize, please update _config.yml
:
1 | copyright: |
Language configuration
If you are new to Hexo and internationalization (i18n), please read
Hexo documentation - internationalization (i18n) section
Currently, the theme is delivered with support for:
- English (en), default
- Brazilian Portuguese (pt-br)
- Catalan (ca)
- Chinese (Simplified, PRC) (zh-CN)
- Dutch (nl)
- French (fr)
- Italian (it)
- Persian (fa)
- Russian (ru)
- Spanish (es)
- German (de)
If you would like to use one the languages listed above, simply set language
to the desired language (e.g., fr
) in _config.yml
.
Otherwise, you can follow the steps below (E.g., to add a Japanese (ja) translation):
- Set
language
toja
in Hexo configuration file_config.yml
- Create a
ja.yml
file in thethemes/cactus/languages/
folder - Copy the content of
themes/cactus/languages/default.yml
and paste it it into theja.yml
file - Replace all English strings by their Japanese translation
Note: Cactus does not support multi-language sites.
RTL support
This theme support RTL languages for Persian and Arabic language.
If you would like to use RTL layout, change direction
attribute in _config.yml
to rtl
.
Note that this also will change the font to Vazir, which is a Persian font.
1 | direction: rtl |
RSS
Set the rss
field in the _config.yml
to one of the following values:
rss: false
will totally disable rss (default).rss: atom.xml
sets a specific feed link.rss:
leave empty to use the hexo-generator-feed plugin.
Analytics
Add you Google, Baidu, Cloudflare or Umami Analytics tracking_id
to the _config.yml
.
1 | google_analytics: |
CDN
Load Javascript and CSS resources from a CDN. Enabled by default, loads all resources from cdnjs.
1 | cdn: |
Set enable: false
to completely disable CDN and load all resources from your domain. If you want to disable it only for specific resource(s) then just remove the corresponding entry(s).
1 | cdn: |
Only JQuery will be loaded from the specified CDN.
Comments
Cactus supports two commenting systems: Disqus and Utterances.
Disqus
First, create a site on Disqus: https://disqus.com/admin/create/.
Next, update the _config.yml
file:
1 | disqus: |
where SITENAME
is the name you gave your site on Disqus.
Utterances
First, follow the instructions on the oficial website to setup an issue tracker Utterances will connect to.
Next, update the _config.yml
file:
1 | utterances: |
where each of the parameters are the respective values provided during the configuration of the Utterances:
repo
: the repository Utterances will connect to.issue_term
: the mapping between blog posts and GitHub issues.label
: the label that will be assigned to issues created by Utterancestheme
: the selected Utterances theme.
Code Highlighting
Pick one of the available colorschemes and add it to the _config.yml
:
1 | highlight: COLORSCHEME_NAME |
Tags and categories
Tags and categories can be included in the front-matter of your posts. For example:
1 | title: Tags and Categories |
You can create a page with a tag cloud by running:
1 | $ hexo new page tags |
Next, add type: tags
to the front-matter of source/tags/index.md
. You can also
add a tag cloud to the home page by setting the tags_overview
option to true
.
Similarly, you can create a page with an overview of all categories by running:
1 | $ hexo new page categories |
and adding type: categories
to the front-matter of source/categories/index.md
.
Finally, don’t forget to create a link to these pages, for example in the navigation menu:
1 | nav: |
Local search
First, install the hexo-generate-search
plugin, which will generate a search index file.
1 | $ npm install hexo-generator-search --save |
Next, create a page to display the search engine:
1 | $ hexo new page search |
and put type: search
in the front-matter.
1 | title: Search |
Finally, edit the _config.yml
and add a link to the navigation menu.
1 | nav: |