hexo-theme-yun Documentation
website·Indexed 32 days ago
https://yun.yunyoujun.cn/Documentation for hexo-theme-yun, a custom, responsive, and lightweight theme based on Hexo. Includes guides on theme configuration via _config.yun.yml, page types, third-party service integration, additional dependency library support, and migration guides for versions such as v1.11.x.
What's inside hexo-theme-yun
- hexo-theme-yun is a custom, lightweight, and fast theme based on the Hexo static site generator. It is designed with a focus on simplicity, using native JavaScript instead of jQuery to improve performance and leveraging CDNs to increase access speed. The theme prioritizes a bright mode for better legibility and accessibility, particularly for users with astigmatism.
Overview of hexo-theme-yun
hexo-theme-yun is a custom theme based on the Hexo static site generator. It is designed to be concise, elegant, responsive, and fast. Key technical characteristics include the removal of jQuery in favor of native JavaScript to improve performance and the extensive use of CDNs to increase loading speeds.Create an About page and Site description
The theme supports two types of 'About' content. For a personal about page, create it viahexo new page about. For a site-specific description, create a file atsource/about/site.md. The theme will automatically render the site link in the sidebar ifsite.mdexists.hexo new page aboutConfigure Local Search
Local search requires thehexo-generator-searchdbplugin. It uses native JavaScript (no jQuery) and supports XML format. You must disableengine_searchbefore enablinglocal_search.npm install hexo-generator-searchdbengine_search: enable: false local_search: enable: trueConfigure RSS feed generation
Installhexo-generator-feedto generate RSS feeds. The theme allows you to customize the RSS link and icon within thesocialfield of the theme configuration.npm install hexo-generator-feed --saveIn _config.yun.yml
social: - name: RSS link: /atom.xml icon: ri:rss-line color: orangeEnable word count and read time
To display word counts and estimated read time in articles, install thehexo-wordcountplugin and enable it in the theme configuration file.npm install hexo-wordcountIn _config.yun.yml
wordcount: enable: true count: true time: trueRender mathematical formulas with KaTeX
The theme supports KaTeX for rendering math. By default, KaTeX libraries are only loaded on pages where
katex: trueis set in the front-matter. If global loading is enabled in the theme configuration, this per-page setting is unnecessary. Thekatexfront-matter option accepts a boolean or an object (where only theoptionskey is effective and will be merged with global settings).Formula Syntax:
- Block/Centered: Use
$$ formula $$or\[ formula \]. - Inline: Use
$ formula $or\( formula \).
Important Note on Escaping: When writing directly in Markdown, backslashes must be escaped (e.g., use
\\[ E = mc^2 \\]instead of\[ E = mc^2 \]). To avoid excessive escaping, wrap the formula in an HTML tag like<div>, which prevents the content from being parsed as Markdown.--- title: My Math Page katex: true --- $$ E = mc^2 $$ <div>\[ E = mc^2 \] </div>- Block/Centered: Use
Pin articles using the sticky property
To pin an article to the top of the list, add thestickyproperty to the article's Front Matter. Higher numeric values take priority over lower values (e.g.,sticky: 2appears abovesticky: 1).--- title: My Sticky Post sticky: 2 ---Configure Algolia search
To use Algolia, installhexo-algoliaorhexo-algoliasearchand enable the search in the config file.algolia_search: enable: true hits: per_page: 10Render mathematical formulas with KaTeX in Yun theme
The Yun theme provides built-in support for KaTeX via CDN, which parses formulas when the page loads. To display a formula inline, use thelatexcode block.\(E = mc ^ 2 \)Use custom local sentences for homepage quotes
To use your own set of quotes instead of a remote API, create a JSON file atsource/data/sentences.json(or any custom folder). The JSON should be an array of objects containingcontent,author, andfromkeys. Then, disable Hitokoto and pointsay.apito the local path.[ { "content": "Hello, World!", "author": "Brian Kernighan", "from": "The C Programming Language" } ]say: enable: true api: /data/sentences.json hitokoto: enable: falseUpdate icon loading to Iconify in v1.10.x
Starting with v1.10.x, the theme uses Iconify to load icon resources. Icon names must be updated to the Iconify format. For example, the Remix Iconicon-github-lineshould be changed tori:github-line.