Overview of Hexo Static Site Generator
Hexo is a static site generator written in JavaScript and TypeScript that runs on Node.js. It is primarily used by developers to build blogs and personal websites.
website·Indexed 43 days ago
https://hexo.ioA fast static site generator. Documentation covers setup, theme creation, tag plugins, and API usage, with release notes spanning from version 2.7 up to v8.1.0.
Hexo is a fast static site generator powered by Node.js. Key capabilities include:
hexo.source for the source folder and hexo.theme for the theme folder. You can load files using process() to load all files once, or watch() to load files and monitor them for changes.// Load all files in the box
box.process().then(function () {
// processing complete
});
// Load files and start watching for changes
box.watch().then(function () {
// You can call box.unwatch() later to stop watching
});Hexo v8.0.0 introduces several functional enhancements:
url configuration.load_config..html extension from permalinks by adding the trailing_html: false option under the pretty_urls configuration. For example, this transforms https://example.com/page/about.html into https://example.com/page/about.# _config.yml
pretty_urls:
trailing_html: falsesource folder. For a small number of site-wide images, the simplest approach is to store them in a source/images directory. These files can be accessed using an absolute path from the site root.include_code tag now supports including specific ranged code lines, allowing developers to embed only a subset of a file's source code in their posts.url_for helper. The url_for helper automatically handles config.root and will generate a relative path if the relative_link setting is enabled.<%# Replace this: %>
<%- config.root %><%- path %>
<%# With this: %>
<%- url_for(path) %>partial to include other template files and fragment_cache to store the output of a function to improve performance.// Load a partial with optional locals and cache settings
<%- partial(layout, [locals], { cache: true, only: false }) %>
// Cache a specific fragment of HTML
<%- fragment_cache('header', function(){ return '<header></header>'; }) %>Several plugins help with SEO and link health:
hexo-auto-canonical: Automatically generates canonical links.hexo-autonofollow: Automatically adds rel="nofollow" to external links.hexo-auto-link-checker: Detects broken links within the site.