Features
First, I’ll introduce you to some easy
Hot Reloading
It’s most worth mentioning that Valaxy supports partial hot reloading, for configuration, post contents, animation, tags, categories, and much more!
For example, if you modified valaxy.config.ts/site.config.ts, the content in xxx.md, or frontmatter (tags/categories), all changes will immediately appear on the preview page, and there is no need for manual refreshing. Also, hot reloads are local, meaning that only the place modified will change, and other elements on the page will not be refreshed.
Customization
Valaxy provides powerful customization support. You can customize every component for your theme and blog just like the Ship of Theseus.
See more at Customizing Components.
UnoCSS
The builtin TailwindCSS-like util class (based on UnoCSS).
If you have used TailwindCSS before, then you will rapidly learn it’s convenience.
You can use it at will in your Markdown and Vue components, and it will finally get packaged by need and loaded.
For example:
This is markdown.
<div class="bg-white text-blue shadow" p="4">
This is markdown.
</div>You will get the effect immediately like this:
Icones
Massive amount of icons
You can use any icons that are from Icônes.
The naming rule is i-${collection}-${name}, e.g. i-ri-home-line.
The theme by default has RemixIcon installed.
If you need any icons from other collections, you can install yourself. For example:
# `collection` is the name of the icon collection, e.g. @iconify-json/ri
npm i @iconify-json/collectionAll icon names added to config.unocss.safelist will be ready for hot reloading.
UI
Syntax Highlighting
More info about syntax highlighting can be found at Markdown Syntax Highlighting.
Based on Shiki. Valaxy supports syntax highlighting for languages like vue, and also supports copying code and highlighting a particular line in the code block.
For example:
const a = 1
const b = aCustom Theme Color
You only need to provide a theme color for the global color dynamics to work and show effect.
For example, if I want my theme color to be red:
Supported by
valaxy-theme-yun
export default {
themeConfig: {
colors: {
primary: 'red',
},
},
}Even more, other themes can also re-use the default color dynamic functions provided by Valaxy to build their own.
Please refer to code in valaxy-theme-yun for more.
File-based Routing
Routes will be auto-generated for Vue/Markdown files in this dir with the same file structure. Check out vue-router file-based routing for more details.
Building
Supports SPA and SSG.
SSG
Uses the built-in Valaxy SSG engine (Vue SSR + pure string rendering, no JSDOM).
# SSG
npm run build:ssg
# valaxy build --ssgSPA
npm run build:spa
# valaxy buildSEO
Static builds include the tags answer engines and search results use. You do not need a per-post SEO plugin for the defaults below.
- The document title is
Page title - Site title. The homepage, which has no page title, uses the site title alone. A page can settitleTemplate. - The meta description uses frontmatter
description, then a plain-text excerpt of the public body, thensiteConfig.description. link rel="canonical"follows the route’s trailing slash.pages/posts/hello.mdis/posts/hello;pages/about/index.mdis/about/.- Open Graph and Twitter tags are written for every page. The share image is
ogImage, then legacyimage, thencover, then the first content image. SetsiteConfig.seo.ogImagefor pages that have none of those. The favicon is not used. - JSON-LD includes a
WebSite, aPerson(#identity, withsameAsfromsiteConfig.social), and aBreadcrumbList. Posts also getBlogPostingorArticlewithdatePublished,dateModified, the same author id, and the share image. sitemap.xmllists each canonical URL once and addslastmodfrom the page’supdatedordate.robots.txtis generated when you do not providepublic/robots.txt./404and generated/page/2routes arenoindex./page/1canonicalizes to the homepage. SetsiteConfig.seo.pagination: 'index'to keep paginated indexes indexable.- When RSS is enabled (the default) and
siteConfig.urlis configured, pages linkfeed.xmlandatom.xmlwithrel="alternate". - A Markdown image with an empty alt keeps
alt=""by default so decorative images stay ignored by screen readers. Setfeatures.imageAltFallback: trueto fill empty alts from readable filenames (hashes and generic screenshot names stay empty). - Social links that point at an image, such as a QR code, are left out of
sameAs. UsesameAs: falsefor groups and link directories that are not the author.
llms.txt stays off until siteConfig.llms.enable is true. New projects turn it on in the scaffold. See Work with AI.
RSS
Valaxy comes with a command to generate RSS feeds.
For more configuration options, see RSS Configuration.
npm run rss
# valaxy rssi18n in One Page
For more info, see i18n.
Math | 数学公式
Valaxy supports two math rendering engines: KaTeX (default, fast rendering) and MathJax (SVG output, no external CSS/fonts needed).
import { defineValaxyConfig } from 'valaxy'
export default defineValaxyConfig({
// KaTeX (enabled by default)
features: {
katex: true
},
// Or switch to MathJax (install first: pnpm add markdown-it-mathjax3)
// math: true,
})- Math Formulas | Examples
- Load KaTeX from CDN (Experimental)
Auto Route Replacing
When Valaxy detects that an a hyperlink in a post is an intra-site link (relative link), it will automatically replace it with a RouterLink. Enjoy the dynamic page switching!
To Be Continued.