FAQ
The article answers some frequently asked questions about Icarus. If your question is not answered here, you can also refer to Icarus User Guide, Hexo documentation, and GitHub Issues. Additionally, you may find help from other Icarus users on GitHub Discussions.
Site
Icarus 7 runs on Node.js 14.0 or a newer version.
It also requires Hexo 7.1.1 or a newer version (Hexo 8 is supported since Icarus 6.2.0, and it
requires Node.js 20.19.0 or a newer version).
Apart from that, make sure you have all the Node.js dependencies installed.
You can find them in the dependencies section of the
<icarus_directory>/package.json
file.
If you installed Icarus from source, install them in the root directory of your site, as described in
In any case, hexo-renderer-inferno must be listed in the package.json of your site, because Hexo only loads
the plugins listed there; without it, Hexo cannot render the layouts of Icarus.
Also, remove all unused Node.js dependencies from your site, or they may cause strange problems to
Icarus.
Open the site configuration file _config.yml under the root directory.
Change the following setting:
1 | - language: en |
You can find all available translations under the <icarus_directory>/languages directory.
The <language_name> is the translation file name without the .yml extension.
If there is no translation for your language, Icarus falls back to English.
To change the language of a single post, see
Post Language.
Layout
To change the page width, edit the style file <icarus_directory>/include/style/responsive.styl.
It defines the container width under different screen sizes.
To change the width of the widgets or main content, edit <icarus_directory>/layout/common/widgets.jsx and
<icarus_directory>/layout/layout.jsx.
Find the CSS class names like is-12, is-8-tablet, and is-4-widescreen in these files.
The number in the class names marks the number of columns a widget or main content takes.
The screen size after the number, such as tablet and widescreen, refers to the condition when the column
sizes take effect.
Change the number in the class names such that the column count of main column and widget column(s) add up to
12 under the same screen size.
For example, to have the main content column wider on widescreen, you can make the following changes:
1 | <div class={classname({ |
1 | function getColumnSizeClass(columnCount) { |
You can refer to Bulma documentation for more details on the column system.
Here are some tips for creating a one/two/three-column layout:
- You can remove all widgets from your theme configurations, or set
widgetstonull, to create a one-column layout. - You can move all your widgets to the same side of the page to create a two-column layout.
- You can place widgets on both sides of the page to create a three-column layout.
Note that the table of contents widget only shows on posts and pages with toc: true (set in their front-matter
or in a configuration file).
A sidebar that only has the table of contents widget does not take up a column on other pages.
To change the layout for a single or all posts/pages, refer to Configuration Files and Priority.
The layout files for plugins and widgets have been moved to a separate Node.js package called
hexo-component-inferno.
This helps theme developers better reuse common components across different themes and makes overriding these
components easy for average users.
To customize these components, copy the layout files from the hexo-component-inferno repository and place
them in the corresponding directories under <icarus_directory>/layout.
For example, if you want to customize the Waline comment plugin, you can copy
src/view/comment/waline.jsx
from the hexo-component-inferno repository to <icarus_directory>/layout/comment/waline.jsx.
Copy the file from the release you have installed (see the version in
node_modules/hexo-component-inferno/package.json), as the latest code in the repository may need a newer
release.
Also, remember to change the relative imports of ../../util/... to hexo-component-inferno/lib/util/...,
like the following:
1 | - const { cacheComponent } = require('../../util/cache'); |
Finally, hexo clean your site before regenerating the HTML.
Similarly, you can override static files like
asset/js/insight.js
by putting your own copy at the same path under the theme’s source directory, e.g.,
<icarus_directory>/source/js/insight.js.
Icarus caches the layout files when you start the local Hexo server with the hexo server command.
To make the layout changes take effect, restart the local server.
Other times some intermediate data may be cached by Hexo in the memory or db.json database.
Running hexo clean before hexo server or hexo generate should resolve this issue.
Content
Make sure you use the absolute paths (starting with /) to your images.
For example, your site is in a subdirectory of your domain name like
https://ppoffice.github.io/hexo-theme-icarus (i.e., root: /hexo-theme-icarus/ in your site configuration
_config.yml) and your image image.jpg is under source/gallery/.
In Markdown, include your image without the subdirectory, like this: .
The Markdown renderer (hexo-renderer-marked, with its default prependRoot: true) adds the root to image
paths for you, so writing the subdirectory yourself would make it appear twice.
HTML <img> tags, on the other hand, are left as they are, so you need to include the subdirectory yourself:
<img src="/hexo-theme-icarus/gallery/image.jpg">.
You can also use Hexo’s {% img %} tag like the following to include an
image automatically:
1 | {% img /gallery/image.jpg "Image title" %} |
In this case, you may omit the subdirectory from your image path as well. You can refer to Hexo documentation for more details.
Put a <!-- more --> tag in your post.
Post content before this tag will be marked as an excerpt.
Content after this tag will not show up on index pages.
You can also specify a custom excerpt in the post’s front-matter.
1 | title: Some Post |
Use third-party Hexo plugins such as hexo-blog-encrypt.
Refer to Bulma documentation for all available elements and styles. Copy the HTML snippets and put them in your Markdown files directly.
Widgets and Plugins
Those alerts usually show up when you miss out on some plugin or widget configurations.
For example, the _config.icarus.yml that Icarus generates on the first run enables a comment plugin, donation
buttons, share buttons, and several widgets (such as AdSense and follow.it) with empty placeholder values.
Fill in the values of the ones you want to use.
If you don’t want to enable a certain plugin or widget, delete it or comment it out from your theme configurations.
For example, you can disable the comment plugins by commenting out the following lines:
1 | - comment: |
To disable a plugin for a single post, see Post/Page Front-matter.
