<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom"><title>Methanol Docs</title><link href="https://methanol.sudomaker.com/"/><link rel="self" href="https://methanol.sudomaker.com/atom.xml"/><id>https://methanol.sudomaker.com/atom.xml</id><updated>2026-08-13T20:12:38.118Z</updated><generator>Methanol</generator><entry><title>Using Components</title><link href="https://methanol.sudomaker.com/guide/components"/><id>https://methanol.sudomaker.com/guide/components</id><summary>Techniques for embedding and overriding JSX components within MDX.</summary><content type="html">&lt;h1 id=&quot;using-components&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#using-components&quot; aria-label=&quot;Link to using-components&quot;&gt;&lt;/a&gt;Using Components&lt;/h1&gt;
&lt;p&gt;MDX allows you to directly embed &lt;a href=&quot;https://github.com/SudoMaker/rEFui&quot;&gt;rEFui&lt;/a&gt; JSX components within your Markdown. By placing reusable components in the &lt;code&gt;components/&lt;/code&gt; directory, they become seamlessly integrated and available for use across all pages.&lt;/p&gt;
&lt;h2 id=&quot;component-creation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#component-creation&quot; aria-label=&quot;Link to component-creation&quot;&gt;&lt;/a&gt;Component Creation&lt;/h2&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt;// components/Callout.jsx&lt;/span&gt;
&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;pl-en&quot;&gt;Callout&lt;/span&gt;(&lt;span class=&quot;pl-smi&quot;&gt;props&lt;/span&gt;, &lt;span class=&quot;pl-k&quot;&gt;...&lt;/span&gt;&lt;span class=&quot;pl-v&quot;&gt;children&lt;/span&gt;) {
	&lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;callout&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-k&quot;&gt;...&lt;/span&gt;children}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;utilization-in-mdx&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#utilization-in-mdx&quot; aria-label=&quot;Link to utilization-in-mdx&quot;&gt;&lt;/a&gt;Utilization in MDX&lt;/h2&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&amp;lt;&lt;span class=&quot;pl-c1&quot;&gt;Callout&lt;/span&gt;&amp;gt;
  Tip: Maintain concise and focused sections to improve readability.
&amp;lt;/&lt;span class=&quot;pl-c1&quot;&gt;Callout&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;client-side-interactivity&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#client-side-interactivity&quot; aria-label=&quot;Link to client-side-interactivity&quot;&gt;&lt;/a&gt;Client-side Interactivity&lt;/h2&gt;
&lt;p&gt;For components that require access to browser-specific APIs, append the &lt;code&gt;.client&lt;/code&gt; suffix to the filename:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code&gt;components/Map.client.jsx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;interactive-example-counter&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#interactive-example-counter&quot; aria-label=&quot;Link to interactive-example-counter&quot;&gt;&lt;/a&gt;Interactive Example: Counter&lt;/h2&gt;
&lt;p&gt;Below is a simple interactive component:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt;// components/Counter.client.jsx&lt;/span&gt;
&lt;span class=&quot;pl-k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./Counter.css&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;pl-k&quot;&gt;import&lt;/span&gt; { &lt;span class=&quot;pl-smi&quot;&gt;signal&lt;/span&gt; } &lt;span class=&quot;pl-k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;refui&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;pl-en&quot;&gt;Counter&lt;/span&gt;({ initial &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;0&lt;/span&gt; }) {
	&lt;span class=&quot;pl-k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-en&quot;&gt;signal&lt;/span&gt;(initial)
	&lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; (
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;counter&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;button on&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt;click&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{() &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;count&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;--&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;-&amp;lt;/&lt;/span&gt;button&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;span&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{count}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;span&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;button on&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt;click&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{() &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;count&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;++&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;+&amp;lt;/&lt;/span&gt;button&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
	)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As this component includes a CSS import (which is incompatible with server-side static rendering), a corresponding static version must be provided for the build process:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-c&quot;&gt;// components/Counter.static.jsx&lt;/span&gt;
&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;pl-en&quot;&gt;Counter&lt;/span&gt;({ initial &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;0&lt;/span&gt; }) {
	&lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; (
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			[ JavaScript is required to load &lt;span class=&quot;pl-c1&quot;&gt;this&lt;/span&gt; component. ]
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
	)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Invoking the component within a page:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&amp;lt;&lt;span class=&quot;pl-c1&quot;&gt;Counter&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;initial&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-pse&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pl-pse&quot;&gt;}&lt;/span&gt;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Live Preview:&lt;/p&gt;
&lt;div&gt;[ You need to enable JavaScript to load this component. ]&lt;/div&gt;
&lt;p&gt;For more advanced component patterns, refer to &lt;a href=&quot;../advanced/components&quot;&gt;Custom Components&lt;/a&gt;.&lt;/p&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T07:54:27.449Z</updated></entry><entry><title>Configuration</title><link href="https://methanol.sudomaker.com/reference/configuration"/><id>https://methanol.sudomaker.com/reference/configuration</id><summary>Detailed specifications for site metadata, directory structures, themes, asset management, and CLI overrides.</summary><content type="html">&lt;h1 id=&quot;configuration&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#configuration&quot; aria-label=&quot;Link to configuration&quot;&gt;&lt;/a&gt;Configuration&lt;/h1&gt;
&lt;p&gt;Methanol automatically resolves configuration from the following file patterns:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code&gt;methanol.config.{js,mjs,cjs,ts,jsx,tsx,mts,cts}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the absence of a configuration file, Methanol applies sensible defaults inferred from the project&amp;#039;s root directory.&lt;/p&gt;
&lt;h2 id=&quot;configuration-schema&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#configuration-schema&quot; aria-label=&quot;Link to configuration-schema&quot;&gt;&lt;/a&gt;Configuration Schema&lt;/h2&gt;
&lt;p&gt;The configuration file must export a function that receives an execution context and returns a configuration object.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; ({ mode, root, HTMLRenderer }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	&lt;span class=&quot;pl-c&quot;&gt;// configuration properties&lt;/span&gt;
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Execution context properties:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mode&lt;/code&gt;: Either &lt;code&gt;development&lt;/code&gt; or &lt;code&gt;production&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;root&lt;/code&gt;: The absolute path to the project root.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HTMLRenderer&lt;/code&gt;: rEFui HTML utilities (including &lt;code&gt;rawHTML&lt;/code&gt; and &lt;code&gt;serialize&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;core-options&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#core-options&quot; aria-label=&quot;Link to core-options&quot;&gt;&lt;/a&gt;Core Options&lt;/h2&gt;
&lt;h3 id=&quot;root&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#root&quot; aria-label=&quot;Link to root&quot;&gt;&lt;/a&gt;&lt;code&gt;root&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The project root directory. Defaults to the current working directory (CWD).&lt;/p&gt;
&lt;h3 id=&quot;site&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#site&quot; aria-label=&quot;Link to site&quot;&gt;&lt;/a&gt;&lt;code&gt;site&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Site-wide metadata utilized by templates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;site.name&lt;/code&gt;: The title of the site.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.owner&lt;/code&gt;: The site owner or author (used in the blog theme footer and feeds).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.logo&lt;/code&gt;: Path to the logo asset (string), or &lt;code&gt;false&lt;/code&gt; to disable (standard theme support).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.favicon&lt;/code&gt;: Path to the favicon asset (string), or &lt;code&gt;false&lt;/code&gt; to disable (standard theme support).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.base&lt;/code&gt;: The Base Path prefix used when the site is hosted under a subpath (e.g., &lt;code&gt;&amp;#039;/docs/&amp;#039;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.repoBase&lt;/code&gt;: The base URL for the content directory within a repository, used by the standard theme to generate &amp;quot;Edit this page&amp;quot; links.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;site.base&lt;/code&gt; is automatically normalized to include both leading and trailing slashes (e.g., &lt;code&gt;docs&lt;/code&gt; becomes &lt;code&gt;&amp;#039;/docs/&amp;#039;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site.base&lt;/code&gt; configures the Rsbuild asset prefix and server base used by build, dev, and preview.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;methanol dev&lt;/code&gt; preserves &lt;code&gt;site.base&lt;/code&gt;, so subpath deployments can be tested directly in development.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;pagefind&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#pagefind&quot; aria-label=&quot;Link to pagefind&quot;&gt;&lt;/a&gt;&lt;code&gt;pagefind&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Enables and configures full-text search via Pagefind. Default: &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;pagefind&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
pagefind&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; { enabled&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt; }
&lt;span class=&quot;pl-c&quot;&gt;// or detailed configuration&lt;/span&gt;
pagefind&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
	enabled&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;,
	excerptLength&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;30&lt;/span&gt;,
	build&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		outputSubdir&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;pagefind&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		verbose&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Properties other than &lt;code&gt;enabled&lt;/code&gt; and &lt;code&gt;build&lt;/code&gt; are passed directly to the Pagefind JavaScript &lt;code&gt;options()&lt;/code&gt; initialization.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;build&lt;/code&gt; object contains options specific to the build-time indexing process.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;feed&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#feed&quot; aria-label=&quot;Link to feed&quot;&gt;&lt;/a&gt;&lt;code&gt;feed&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Enables RSS/Atom feed generation. Default: &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;feed&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
feed&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
	enabled&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;,
	path&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;/rss.xml&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
	limit&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;10&lt;/span&gt;,
	siteUrl&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;https://example.com&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
	title&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
	description&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Updates from my site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
	language&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;en&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
	atom&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;false&lt;/span&gt;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;atom: true&lt;/code&gt; to output Atom instead of RSS (default paths: &lt;code&gt;/rss.xml&lt;/code&gt; or &lt;code&gt;/atom.xml&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;siteUrl&lt;/code&gt; must be an absolute URL. If omitted, Methanol uses &lt;code&gt;site.base&lt;/code&gt;, so set it to a full origin (e.g. &lt;code&gt;https://example.com/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Hidden pages are excluded. &lt;code&gt;limit&lt;/code&gt; defaults to &lt;code&gt;10&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Feed items use &lt;code&gt;frontmatter.author&lt;/code&gt; when provided, falling back to &lt;code&gt;site.owner&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;pwa&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#pwa&quot; aria-label=&quot;Link to pwa&quot;&gt;&lt;/a&gt;&lt;code&gt;pwa&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Enables Methanol&amp;#039;s built-in PWA support, featuring a custom service worker and an automated precache manifest. Default: &lt;code&gt;false&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;pwa&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
pwa&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or detailed configuration&lt;/span&gt;
pwa&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
	manifest&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		name&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		short_name&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
	},
	precache&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		include&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; [&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/*.{html,js,css,ico,png,svg,webp,jpg,jpeg,gif,woff,woff2,ttf}&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;],
		exclude&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; [&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/*.map&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/pagefind/**&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;],
		priority&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;,
		limit&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;,
		batchSize&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;manifest&lt;/code&gt; is merged into the generated &lt;code&gt;manifest.webmanifest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;precache&lt;/code&gt; configuration governs &lt;code&gt;precache-manifest.json&lt;/code&gt;, used by the built-in service worker for installation and warming.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;precache.priority&lt;/code&gt;: Ordered list of glob patterns to cache immediately.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;precache.limit&lt;/code&gt;: Maximum number of entries in the precache manifest (&lt;code&gt;null&lt;/code&gt; for unlimited).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;precache.batchSize&lt;/code&gt;: Number of concurrent fetches during installation/warmup.&lt;/li&gt;
&lt;li&gt;The precache manifest is generated from the finalized &lt;code&gt;dist/&lt;/code&gt; tree rather than the Rsbuild module graph. It excludes &lt;code&gt;sw.js&lt;/code&gt; and &lt;code&gt;precache-manifest.json&lt;/code&gt; to avoid self-referential revisions.&lt;/li&gt;
&lt;li&gt;To fully customize PWA behavior, set &lt;code&gt;pwa: false&lt;/code&gt; and provide your own manifest and service worker.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;starrynight&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#starrynight&quot; aria-label=&quot;Link to starrynight&quot;&gt;&lt;/a&gt;&lt;code&gt;starryNight&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Controls syntax highlighting via Starry Night (rehype-starry-night). Default: &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;starryNight&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
starryNight&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or detailed configuration&lt;/span&gt;
starryNight&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
	&lt;span class=&quot;pl-c&quot;&gt;// options passed to rehype-starry-night&lt;/span&gt;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;When configured as an object, highlighting is enabled unless &lt;code&gt;enabled: false&lt;/code&gt; is explicitly set.&lt;/li&gt;
&lt;li&gt;Per-page Frontmatter settings always take precedence over global configuration.&lt;/li&gt;
&lt;li&gt;The CLI flags &lt;code&gt;--highlight&lt;/code&gt; and &lt;code&gt;--no-highlight&lt;/code&gt; can be used to override this setting per-execution.&lt;/li&gt;
&lt;li&gt;Methanol automatically loads grammars for fenced code languages it encounters. Use &lt;code&gt;starryNight.grammars&lt;/code&gt; only to force ambiguous mappings or to supply unsupported grammars.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;jobs&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#jobs&quot; aria-label=&quot;Link to jobs&quot;&gt;&lt;/a&gt;&lt;code&gt;jobs&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Controls the worker thread count used during the build pipeline. Default: &lt;code&gt;0&lt;/code&gt; (auto based on page count).&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;jobs&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;pl-c&quot;&gt;// auto (round(ln(pageCount))), clamped to CPU cores&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
jobs&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;The CLI flag &lt;code&gt;--jobs&lt;/code&gt; (alias &lt;code&gt;-j&lt;/code&gt;) overrides this setting per-execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;gfm&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#gfm&quot; aria-label=&quot;Link to gfm&quot;&gt;&lt;/a&gt;&lt;code&gt;gfm&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Enables or disables GitHub Flavored Markdown (GFM) support. Default: &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;When enabled, Methanol applies GFM-specific parsing, including tables, task lists, strikethrough, footnotes, and autolink literals.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;gfm&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;pl-c&quot;&gt;// or&lt;/span&gt;
gfm&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;pagesdir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#pagesdir&quot; aria-label=&quot;Link to pagesdir&quot;&gt;&lt;/a&gt;&lt;code&gt;pagesDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The source directory for MDX and Markdown files. Defaults to &lt;code&gt;pages&lt;/code&gt;, with an automatic fallback to &lt;code&gt;docs&lt;/code&gt; if &lt;code&gt;pages/&lt;/code&gt; is not found.&lt;/p&gt;
&lt;h3 id=&quot;componentsdir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#componentsdir&quot; aria-label=&quot;Link to componentsdir&quot;&gt;&lt;/a&gt;&lt;code&gt;componentsDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The directory for JSX/TSX components. Defaults to &lt;code&gt;components&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;If &lt;code&gt;pagesDir&lt;/code&gt; or &lt;code&gt;componentsDir&lt;/code&gt; are explicitly defined (via configuration or CLI) but do not exist, Methanol will throw an error.&lt;/p&gt;
&lt;h3 id=&quot;publicdir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#publicdir&quot; aria-label=&quot;Link to publicdir&quot;&gt;&lt;/a&gt;&lt;code&gt;publicDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The directory for static assets served at the site root (e.g., &lt;code&gt;public/foo.png&lt;/code&gt; maps to &lt;code&gt;/foo.png&lt;/code&gt;). Default: &lt;code&gt;public&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Methanol automatically merges assets from the theme&amp;#039;s &lt;code&gt;publicDir&lt;/code&gt;. In the event of a path conflict, user-provided assets override theme assets.&lt;/p&gt;
&lt;p&gt;Temporary merged assets are managed within &lt;code&gt;node_modules/.methanol/assets&lt;/code&gt; (or &lt;code&gt;{pagesDir}/.methanol/assets&lt;/code&gt; if &lt;code&gt;node_modules/&lt;/code&gt; is unavailable).&lt;/p&gt;
&lt;p&gt;Set &lt;code&gt;publicDir: false&lt;/code&gt; to disable all static asset processing.&lt;/p&gt;
&lt;h3 id=&quot;distdir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#distdir&quot; aria-label=&quot;Link to distdir&quot;&gt;&lt;/a&gt;&lt;code&gt;distDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The destination directory for production builds. Default: &lt;code&gt;dist&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;builddir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#builddir&quot; aria-label=&quot;Link to builddir&quot;&gt;&lt;/a&gt;&lt;code&gt;buildDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The directory for intermediate build artifacts. Default: &lt;code&gt;build&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&quot;intermediatedir&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#intermediatedir&quot; aria-label=&quot;Link to intermediatedir&quot;&gt;&lt;/a&gt;&lt;code&gt;intermediateDir&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Explicit directory for intermediate HTML output (build only).&lt;/p&gt;
&lt;h3 id=&quot;emitintermediate&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#emitintermediate&quot; aria-label=&quot;Link to emitintermediate&quot;&gt;&lt;/a&gt;&lt;code&gt;emitIntermediate&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Boolean. If &lt;code&gt;true&lt;/code&gt;, Methanol writes intermediate HTML to the &lt;code&gt;build/&lt;/code&gt; directory during the build process.&lt;/p&gt;
&lt;h3 id=&quot;theme&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme&quot; aria-label=&quot;Link to theme&quot;&gt;&lt;/a&gt;&lt;code&gt;theme&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Configures the site&amp;#039;s theme. This can be a theme object (see below) or a string. When a string is provided, Methanol resolves it using the following priority:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Built-in Themes:&lt;/strong&gt; Matches against Methanol&amp;#039;s internal themes (e.g., &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;blog&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Package Resolution:&lt;/strong&gt; Searches for a package named &lt;code&gt;methanol-theme-xxx&lt;/code&gt; (where &lt;code&gt;xxx&lt;/code&gt; is your input).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For local themes (files inside your project), import them in &lt;code&gt;methanol.config.*&lt;/code&gt; and set &lt;code&gt;theme&lt;/code&gt; to the imported theme object/factory.&lt;/p&gt;
&lt;p&gt;Refer to the &lt;a href=&quot;../advanced/themes/&quot;&gt;Advanced Theme Guide&lt;/a&gt; for complete specifications of the theme object.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;theme.root&lt;/code&gt;: The theme&amp;#039;s root directory (required).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.template&lt;/code&gt;: The JSX function defining the HTML layout.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.components&lt;/code&gt;: Default components provided by the theme.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.componentsDir&lt;/code&gt;: Directory for theme-specific components.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.pagesDir&lt;/code&gt;: Directory for theme-provided pages.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.publicDir&lt;/code&gt;: Theme static assets (merged into &lt;code&gt;publicDir&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.sources&lt;/code&gt;: Virtual path mappings resolved by Methanol.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.mdx&lt;/code&gt;: Default MDX options merged with user settings.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theme.rsbuild&lt;/code&gt;: Default Rsbuild configuration merged with user settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;mdx&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#mdx&quot; aria-label=&quot;Link to mdx&quot;&gt;&lt;/a&gt;&lt;code&gt;mdx&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Customizes the MDX compilation process. Receives &lt;code&gt;{ mode, root }&lt;/code&gt; and returns an MDX options object.&lt;/p&gt;
&lt;p&gt;With the built-in MDX pipeline, compiled page output is cached under &lt;code&gt;{pagesDir}/.methanol/cache/mdx&lt;/code&gt;. This generated directory is safe to delete and should not be committed. Source, Frontmatter, compiler, and relevant local-link changes invalidate the affected page entry. Production builds still execute every page module, synchronize derived titles and ToCs, and re-render every page, so shared navigation always reflects metadata changes. Persistent reuse is disabled when user or theme &lt;code&gt;mdx&lt;/code&gt; configuration is present because arbitrary plugin behavior cannot be safely fingerprinted.&lt;/p&gt;
&lt;h3 id=&quot;rsbuild&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#rsbuild&quot; aria-label=&quot;Link to rsbuild&quot;&gt;&lt;/a&gt;&lt;code&gt;rsbuild&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Deep-merges custom Rsbuild configuration. A configuration function receives &lt;code&gt;{ command, mode, root, isPreview }&lt;/code&gt;, where &lt;code&gt;command&lt;/code&gt; is &lt;code&gt;build&lt;/code&gt;, &lt;code&gt;dev&lt;/code&gt;, or &lt;code&gt;preview&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Methanol owns the project root, generated entries, output root, asset manifest, public directory integration, and HTML processing. Other Rsbuild settings—including plugins, resolution, source transforms, server options, and output optimization—can be extended normally.&lt;/p&gt;
&lt;h3 id=&quot;build-hooks&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#build-hooks&quot; aria-label=&quot;Link to build-hooks&quot;&gt;&lt;/a&gt;Build Hooks&lt;/h3&gt;
&lt;p&gt;Hooks for extending the build pipeline.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;preBuild&lt;/code&gt;: Executes at dev server initialization and prior to the build process.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;preBundle&lt;/code&gt;: Build only; executes after page rendering but before Rsbuild asset bundling.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postBundle&lt;/code&gt;: Build only; executes after Rsbuild bundling and before HTML asset rewriting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;preWrite&lt;/code&gt;: Build only; executes immediately before generated HTML is rewritten and written.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postWrite&lt;/code&gt;: Build only; executes after generated HTML is written.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;finalize&lt;/code&gt;: Build only; executes after output is written but before Pagefind, feeds, and PWA manifests are generated.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postBuild&lt;/code&gt;: Build only; executes after the entire build process is complete.&lt;/li&gt;
&lt;li&gt;Hooks accept either a single function or an array of functions.&lt;/li&gt;
&lt;li&gt;Execution sequence: &lt;code&gt;preBuild&lt;/code&gt; → Render → &lt;code&gt;preBundle&lt;/code&gt; → Rsbuild bundle → &lt;code&gt;postBundle&lt;/code&gt; → &lt;code&gt;preWrite&lt;/code&gt; → HTML rewrite → &lt;code&gt;postWrite&lt;/code&gt; → &lt;code&gt;finalize&lt;/code&gt; → Pagefind/feed/PWA generation → &lt;code&gt;postBuild&lt;/code&gt;. User and theme hooks run in Methanol&amp;#039;s documented phase order.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hook Context:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;mode&lt;/code&gt;, &lt;code&gt;root&lt;/code&gt;, &lt;code&gt;command&lt;/code&gt;, &lt;code&gt;isDev&lt;/code&gt;, &lt;code&gt;isBuild&lt;/code&gt;, &lt;code&gt;isPreview&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HTMLRenderer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;site&lt;/code&gt; (reflects the current &lt;code&gt;ctx.site&lt;/code&gt; state).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;data&lt;/code&gt;: A mutable object for sharing state across the hook lifecycle.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Build-only hooks additionally receive:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pagesContext&lt;/code&gt;, &lt;code&gt;pages&lt;/code&gt;, &lt;code&gt;pagesTree&lt;/code&gt;, and &lt;code&gt;pagesByRoute&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	&lt;span class=&quot;pl-en&quot;&gt;preBuild&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ data, site }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; {
		&lt;span class=&quot;pl-smi&quot;&gt;data&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;startedAt&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;Date&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;now&lt;/span&gt;()
		&lt;span class=&quot;pl-en&quot;&gt;console&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;log&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Building:&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-smi&quot;&gt;site&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;name&lt;/span&gt;)
	},
	&lt;span class=&quot;pl-en&quot;&gt;preBundle&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ pages }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; {
		&lt;span class=&quot;pl-en&quot;&gt;console&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;log&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Total rendered pages:&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-smi&quot;&gt;pages&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;length&lt;/span&gt;)
	},
	&lt;span class=&quot;pl-en&quot;&gt;postBuild&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ data, pages }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; {
		&lt;span class=&quot;pl-en&quot;&gt;console&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;log&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Build duration (ms):&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-c1&quot;&gt;Date&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;now&lt;/span&gt;() &lt;span class=&quot;pl-k&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;data&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;startedAt&lt;/span&gt;)
		&lt;span class=&quot;pl-en&quot;&gt;console&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;log&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Final page count:&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-smi&quot;&gt;pages&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;length&lt;/span&gt;)
	}
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;cli-overrides&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#cli-overrides&quot; aria-label=&quot;Link to cli-overrides&quot;&gt;&lt;/a&gt;CLI Overrides&lt;/h2&gt;
&lt;p&gt;Command-line arguments take precedence over configuration file settings:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--input&lt;/code&gt; and &lt;code&gt;--components&lt;/code&gt; override &lt;code&gt;pagesDir&lt;/code&gt; and &lt;code&gt;componentsDir&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--assets&lt;/code&gt; overrides &lt;code&gt;publicDir&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--output&lt;/code&gt; overrides &lt;code&gt;distDir&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--site-name&lt;/code&gt; overrides &lt;code&gt;site.name&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--owner&lt;/code&gt; overrides &lt;code&gt;site.owner&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--base&lt;/code&gt; temporarily overrides &lt;code&gt;site.base&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--search&lt;/code&gt;/&lt;code&gt;--no-search&lt;/code&gt; override &lt;code&gt;pagefind.enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--rss&lt;/code&gt;/&lt;code&gt;--no-rss&lt;/code&gt; override &lt;code&gt;feed.enabled&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--atom&lt;/code&gt;/&lt;code&gt;--no-atom&lt;/code&gt; override &lt;code&gt;feed.atom&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--pwa&lt;/code&gt;/&lt;code&gt;--no-pwa&lt;/code&gt; override the &lt;code&gt;pwa&lt;/code&gt; toggle.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-v&lt;/code&gt;/&lt;code&gt;--verbose&lt;/code&gt; enables detailed build logging.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--config&lt;/code&gt; specifies a non-standard configuration file.&lt;/li&gt;
&lt;li&gt;Positional &lt;code&gt;input&lt;/code&gt;/&lt;code&gt;output&lt;/code&gt; arguments map to the &lt;code&gt;--input&lt;/code&gt;/&lt;code&gt;--output&lt;/code&gt; flags.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;implementation-example&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#implementation-example&quot; aria-label=&quot;Link to implementation-example&quot;&gt;&lt;/a&gt;Implementation Example&lt;/h2&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;import&lt;/span&gt; { &lt;span class=&quot;pl-smi&quot;&gt;pluginTailwindcss&lt;/span&gt; } &lt;span class=&quot;pl-k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;@rsbuild/plugin-tailwindcss&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;

&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; ({ mode }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	site&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; { name&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;Technical Docs&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt; },
	theme&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		root&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;.&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		&lt;span class=&quot;pl-en&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ PageContent, ExtraHead, ctx, withBase, HTMLRenderer, components }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt;
				{&lt;span class=&quot;pl-smi&quot;&gt;HTMLRenderer&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;rawHTML&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&amp;lt;!doctype html&amp;gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&lt;/span&gt;}
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;html lang&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;en&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;meta charset&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;UTF-8&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;meta name&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;viewport&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; content&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;width=device-width&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;ExtraHead &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;site&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;name&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;link rel&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;icon&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; href&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;/favicon.png&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						{&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;Important Note&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;}
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;PageContent &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
		),
		components&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			&lt;span class=&quot;pl-en&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ children }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;callout-component&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{children}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		}
	},
	&lt;span class=&quot;pl-en&quot;&gt;mdx&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
		development&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; mode &lt;span class=&quot;pl-k&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;production&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
	}),
	&lt;span class=&quot;pl-en&quot;&gt;rsbuild&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
		server&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; { port&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;3000&lt;/span&gt; },
		plugins&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; [&lt;span class=&quot;pl-en&quot;&gt;pluginTailwindcss&lt;/span&gt;()]
	})
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T07:50:39.769Z</updated></entry><entry><title>Quick Start</title><link href="https://methanol.sudomaker.com/quick-start"/><id>https://methanol.sudomaker.com/quick-start</id><summary>Project structure, core commands, and creating your first page in Methanol.</summary><content type="html">&lt;h1 id=&quot;quick-start&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#quick-start&quot; aria-label=&quot;Link to quick-start&quot;&gt;&lt;/a&gt;Quick Start&lt;/h1&gt;
&lt;p&gt;Methanol transforms a directory of Markdown and MDX files into a high-performance static site with automatic routing, navigation, and a robust build pipeline.&lt;/p&gt;
&lt;p&gt;Getting started is simple: create &lt;code&gt;pages/index.mdx&lt;/code&gt;, add your content, and Methanol will automatically build the routes and navigation tree.&lt;/p&gt;
&lt;h2 id=&quot;instant-preview&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#instant-preview&quot; aria-label=&quot;Link to instant-preview&quot;&gt;&lt;/a&gt;Instant Preview&lt;/h2&gt;
&lt;p&gt;Experience Methanol immediately by running the development server via &lt;code&gt;npx&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Then, open &lt;code&gt;http://localhost:3000&lt;/code&gt; in your browser.&lt;/p&gt;
&lt;h2 id=&quot;using-an-existing-directory&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#using-an-existing-directory&quot; aria-label=&quot;Link to using-an-existing-directory&quot;&gt;&lt;/a&gt;Using an Existing Directory&lt;/h2&gt;
&lt;p&gt;If you already have a collection of Markdown or MDX files, point Methanol directly to that directory:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol dev ./my-docs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The specified folder becomes the content root; for example, &lt;code&gt;./my-docs/index.mdx&lt;/code&gt; maps to the site root (&lt;code&gt;/&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&quot;installation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#installation&quot; aria-label=&quot;Link to installation&quot;&gt;&lt;/a&gt;Installation&lt;/h2&gt;
&lt;p&gt;For frequent use, we recommend installing Methanol globally to benefit from faster CLI startup:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npm install methanol -g
methanol dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;production-workflow&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#production-workflow&quot; aria-label=&quot;Link to production-workflow&quot;&gt;&lt;/a&gt;Production Workflow&lt;/h2&gt;
&lt;p&gt;Generate an optimized production build and preview it locally:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;methanol build
methanol serve
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;serve&lt;/code&gt; command hosts the contents of the &lt;code&gt;dist/&lt;/code&gt; directory for final verification.&lt;/p&gt;
&lt;h2 id=&quot;advanced-build-example&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#advanced-build-example&quot; aria-label=&quot;Link to advanced-build-example&quot;&gt;&lt;/a&gt;Advanced Build Example&lt;/h2&gt;
&lt;p&gt;Methanol&amp;#039;s CLI supports various flags to override configurations on the fly:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;methanol build --pwa --search --theme blog --site-name &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command enables PWA and search indexing, switches to the &lt;code&gt;blog&lt;/code&gt; theme, and sets a custom site name.&lt;/p&gt;
&lt;h2 id=&quot;project-structure&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#project-structure&quot; aria-label=&quot;Link to project-structure&quot;&gt;&lt;/a&gt;Project Structure&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pages/&lt;/code&gt;: MDX/MD source files (alternatively &lt;code&gt;docs/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;components/&lt;/code&gt;: Reusable JSX/TSX components.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;public/&lt;/code&gt;: Static assets (overrides theme-provided assets).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dist/&lt;/code&gt;: Optimized production output.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Files in &lt;code&gt;public/&lt;/code&gt; are served at the site root (e.g., &lt;code&gt;public/logo.png&lt;/code&gt; → &lt;code&gt;/logo.png&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&quot;creating-your-first-page&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#creating-your-first-page&quot; aria-label=&quot;Link to creating-your-first-page&quot;&gt;&lt;/a&gt;Creating Your First Page&lt;/h2&gt;
&lt;p&gt;Create &lt;code&gt;pages/index.mdx&lt;/code&gt; with the following content:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;pl-ent&quot;&gt;title&lt;/span&gt;: &lt;span class=&quot;pl-s&quot;&gt;Home&lt;/span&gt;
&lt;span class=&quot;pl-s&quot;&gt;---&lt;/span&gt;

&lt;span class=&quot;pl-mh&quot;&gt;# &lt;span class=&quot;pl-en&quot;&gt;Welcome&lt;/span&gt;&lt;/span&gt;

This is my new documentation site.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The file structure is automatically mapped to URL routes:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code&gt;pages/index.mdx       -&amp;gt; /
pages/guide.mdx       -&amp;gt; /guide
pages/blog/post.mdx   -&amp;gt; /blog/post
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:21:03.396Z</updated></entry><entry><title>CLI</title><link href="https://methanol.sudomaker.com/reference/cli"/><id>https://methanol.sudomaker.com/reference/cli</id><summary>Detailed reference for CLI commands, arguments, and operational flags.</summary><content type="html">&lt;h1 id=&quot;cli&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#cli&quot; aria-label=&quot;Link to cli&quot;&gt;&lt;/a&gt;CLI&lt;/h1&gt;
&lt;p&gt;Methanol includes a dedicated Command-line Interface (CLI) designed to streamline development, execution of static builds, and local previews.&lt;/p&gt;
&lt;h2 id=&quot;core-commands&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#core-commands&quot; aria-label=&quot;Link to core-commands&quot;&gt;&lt;/a&gt;Core Commands&lt;/h2&gt;
&lt;p&gt;Quick start with &lt;code&gt;npx&lt;/code&gt; (recommended):&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol dev      &lt;span class=&quot;pl-c&quot;&gt;# Initialize the development server&lt;/span&gt;
npx methanol build    &lt;span class=&quot;pl-c&quot;&gt;# Execute production build to the dist/ directory&lt;/span&gt;
npx methanol serve    &lt;span class=&quot;pl-c&quot;&gt;# Preview the production build locally&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For improved performance and faster startup times, consider a global installation:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npm install methanol -g
methanol dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;input&lt;/code&gt; and &lt;code&gt;output&lt;/code&gt; paths can be provided as positional arguments (order is significant):&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol build ./pages ./dist
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In &lt;code&gt;dev&lt;/code&gt; mode, only the &lt;code&gt;input&lt;/code&gt; argument is utilized:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol dev ./pages
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;For &lt;code&gt;serve&lt;/code&gt;/&lt;code&gt;preview&lt;/code&gt;, the first positional argument is treated as the output directory:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;npx methanol serve ./dist
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;flag-reference&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#flag-reference&quot; aria-label=&quot;Link to flag-reference&quot;&gt;&lt;/a&gt;Flag Reference&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;--input&lt;/code&gt;, &lt;code&gt;-i&lt;/code&gt;: Specifies the source directory (overrides the default &lt;code&gt;pages/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--components&lt;/code&gt;: Specifies the components directory (overrides the default &lt;code&gt;components/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--assets&lt;/code&gt;: Specifies the static assets directory (overrides the default &lt;code&gt;public/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--output&lt;/code&gt;, &lt;code&gt;-o&lt;/code&gt;: Specifies the build destination (overrides the default &lt;code&gt;dist/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--config&lt;/code&gt;, &lt;code&gt;-c&lt;/code&gt;: Defines the path to a custom configuration file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--theme&lt;/code&gt;: Overrides the &lt;code&gt;theme&lt;/code&gt; configuration. When a string is provided, Methanol first attempts to resolve it as a built-in theme (e.g., &lt;code&gt;default&lt;/code&gt;, &lt;code&gt;blog&lt;/code&gt;). If not found, it searches for a package named &lt;code&gt;methanol-theme-xxx&lt;/code&gt; (where &lt;code&gt;xxx&lt;/code&gt; is the provided string). For local themes, import them in &lt;code&gt;methanol.config.*&lt;/code&gt; and set &lt;code&gt;theme&lt;/code&gt; to the imported theme object/factory.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--site-name&lt;/code&gt;: Overrides the site title defined in configuration.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--owner&lt;/code&gt;: Overrides the site owner (&lt;code&gt;site.owner&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--base&lt;/code&gt;: Temporarily overrides &lt;code&gt;site.base&lt;/code&gt; for the current execution.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--port&lt;/code&gt;: Sets the port for the development and preview servers (default: 3000).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--host&lt;/code&gt;: Binds the server to a specific host (using &lt;code&gt;--host&lt;/code&gt; without a value binds to all interfaces).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--intermediate-dir&lt;/code&gt;: Directory for intermediate HTML output (build only).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--emit-intermediate&lt;/code&gt;: Enables the output of intermediate HTML to &lt;code&gt;build/&lt;/code&gt; (build only).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--highlight&lt;/code&gt;/&lt;code&gt;--no-highlight&lt;/code&gt;: Controls syntax highlighting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--jobs&lt;/code&gt;, &lt;code&gt;-j&lt;/code&gt;: Sets the build worker thread count (&lt;code&gt;0&lt;/code&gt; auto scales with page count).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--search&lt;/code&gt;/&lt;code&gt;--no-search&lt;/code&gt;: Controls Pagefind search indexing.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--rss&lt;/code&gt;/&lt;code&gt;--no-rss&lt;/code&gt;: Controls RSS/Atom feed generation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--atom&lt;/code&gt;/&lt;code&gt;--no-atom&lt;/code&gt;: Outputs Atom when enabled (&lt;code&gt;--rss&lt;/code&gt; is implied).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--pwa&lt;/code&gt;/&lt;code&gt;--no-pwa&lt;/code&gt;: Controls PWA support.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-v&lt;/code&gt;, &lt;code&gt;--verbose&lt;/code&gt;: Enables detailed logging, including Rsbuild and Pagefind output during the build process.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Syntax highlighting is enabled by default and can be disabled per-execution via &lt;code&gt;--no-highlight&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;execution-via-node&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#execution-via-node&quot; aria-label=&quot;Link to execution-via-node&quot;&gt;&lt;/a&gt;Execution via Node&lt;/h2&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;node node_modules/methanol/bin/methanol.js dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:20:51.188Z</updated></entry><entry><title>Offline Access (PWA)</title><link href="https://methanol.sudomaker.com/guide/offline"/><id>https://methanol.sudomaker.com/guide/offline</id><summary>Methanol includes a built-in PWA implementation featuring a custom service worker and an automated precache manifest. Critical assets are cached upon installation, while remaining content is warmed in...</summary><content type="html">&lt;h1 id=&quot;offline-access-pwa&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#offline-access-pwa&quot; aria-label=&quot;Link to offline-access-pwa&quot;&gt;&lt;/a&gt;Offline Access (PWA)&lt;/h1&gt;
&lt;p&gt;Methanol includes a built-in PWA implementation featuring a custom service worker and an automated precache manifest. Critical assets are cached upon installation, while remaining content is warmed in the background with revision-aware updates.&lt;/p&gt;
&lt;h2 id=&quot;enabling-pwa&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#enabling-pwa&quot; aria-label=&quot;Link to enabling-pwa&quot;&gt;&lt;/a&gt;Enabling PWA&lt;/h2&gt;
&lt;p&gt;Enable PWA support in &lt;code&gt;methanol.config.js&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	pwa&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;manifest-customization&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#manifest-customization&quot; aria-label=&quot;Link to manifest-customization&quot;&gt;&lt;/a&gt;Manifest Customization&lt;/h3&gt;
&lt;p&gt;Customize the PWA manifest and precaching strategy as follows:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	pwa&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		manifest&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			name&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
			short_name&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;My Site&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
		},
		precache&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			include&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; [&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/*.{html,js,css,ico,png,svg,webp,jpg,jpeg,gif,woff,woff2,ttf}&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;],
			exclude&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; [&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/*.map&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;**/pagefind/**&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;]
		}
	}
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Precache configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;priority&lt;/code&gt;: Glob patterns to cache immediately (moved to the top of the manifest).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;limit&lt;/code&gt;: Maximum number of entries in the precache manifest.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;batchSize&lt;/code&gt;: Number of concurrent fetches during installation/warmup.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Methanol creates the precache manifest from the finalized &lt;code&gt;dist/&lt;/code&gt; directory, independently of Rsbuild&amp;#039;s module graph. The generated &lt;code&gt;sw.js&lt;/code&gt; is standalone, and both &lt;code&gt;sw.js&lt;/code&gt; and &lt;code&gt;precache-manifest.json&lt;/code&gt; are excluded from their own revision list.&lt;/p&gt;
&lt;h3 id=&quot;advanced-configuration&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#advanced-configuration&quot; aria-label=&quot;Link to advanced-configuration&quot;&gt;&lt;/a&gt;Advanced Configuration&lt;/h3&gt;
&lt;p&gt;For full control over the PWA lifecycle (e.g., custom service worker strategies), set &lt;code&gt;pwa: false&lt;/code&gt; and supply your own manifest and service worker.&lt;/p&gt;
&lt;h2 id=&quot;custom-offline-page&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#custom-offline-page&quot; aria-label=&quot;Link to custom-offline-page&quot;&gt;&lt;/a&gt;Custom Offline Page&lt;/h2&gt;
&lt;p&gt;Create &lt;code&gt;pages/offline.mdx&lt;/code&gt; to define the fallback page displayed when a user is offline and the requested content is uncached. You may also define &lt;code&gt;pages/404.mdx&lt;/code&gt; for &amp;quot;Not Found&amp;quot; errors; both are excluded from navigation by default.&lt;/p&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:20:28.297Z</updated></entry><entry><title>Special-Purpose Pages</title><link href="https://methanol.sudomaker.com/advanced/theme-guide/special-pages"/><id>https://methanol.sudomaker.com/advanced/theme-guide/special-pages</id><summary>Integrating theme-provided pages and implementing differentiated layouts based on routes or frontmatter.</summary><content type="html">&lt;h1 id=&quot;special-purpose-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#special-purpose-pages&quot; aria-label=&quot;Link to special-purpose-pages&quot;&gt;&lt;/a&gt;Special-Purpose Pages&lt;/h1&gt;
&lt;p&gt;Themes can include pre-defined pages via &lt;code&gt;theme.pagesDir&lt;/code&gt;. These pages follow standard routing rules, but user-provided pages always take precedence in the event of a route conflict.&lt;/p&gt;
&lt;p&gt;This feature is ideal for providing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Landing pages&lt;/li&gt;
&lt;li&gt;Specialized index or menu screens&lt;/li&gt;
&lt;li&gt;Link directories or contact forms&lt;/li&gt;
&lt;li&gt;Theme-specific &lt;code&gt;/404&lt;/code&gt; or &lt;code&gt;/offline&lt;/code&gt; fallbacks&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;theme-provided-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-provided-pages&quot; aria-label=&quot;Link to theme-provided-pages&quot;&gt;&lt;/a&gt;Theme-Provided Pages&lt;/h2&gt;
&lt;p&gt;Define your pages directory in the theme entry point:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	theme&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		root&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;.&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		pagesDir&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./pages&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
	}
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;differentiated-layouts&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#differentiated-layouts&quot; aria-label=&quot;Link to differentiated-layouts&quot;&gt;&lt;/a&gt;Differentiated Layouts&lt;/h2&gt;
&lt;p&gt;The most effective way to implement specialized layouts is by defining a &lt;code&gt;layout&lt;/code&gt; property in the page frontmatter.&lt;/p&gt;
&lt;p&gt;Example &lt;code&gt;menu.mdx&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;pl-ent&quot;&gt;title&lt;/span&gt;: &lt;span class=&quot;pl-s&quot;&gt;Menu&lt;/span&gt;
&lt;span class=&quot;pl-ent&quot;&gt;layout&lt;/span&gt;: &lt;span class=&quot;pl-s&quot;&gt;menu&lt;/span&gt;
&lt;span class=&quot;pl-ent&quot;&gt;hidden&lt;/span&gt;: &lt;span class=&quot;pl-c1&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;pl-s&quot;&gt;---&lt;/span&gt;

&lt;span class=&quot;pl-mh&quot;&gt;# &lt;span class=&quot;pl-en&quot;&gt;Menu content&lt;/span&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Template implementation:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;MenuLayout&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; ({ ctx, PageContent }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
	&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;menu-layout&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;h1&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;h1&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;PageContent &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
)

&lt;span class=&quot;pl-k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;DocLayout&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; ({ ctx, PageContent }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
	&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;doc-layout&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;aside&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-c&quot;&gt;/* Sidebar */&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;aside&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;main&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;PageContent &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;main&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
	&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
)

&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;pl-en&quot;&gt;PageTemplate&lt;/span&gt;({ PageContent, ExtraHead, ctx }) {
	&lt;span class=&quot;pl-k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;layout&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;frontmatter&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;layout&lt;/span&gt;
	&lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; (
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;html&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;ExtraHead &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;site&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;name&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					{layout &lt;span class=&quot;pl-k&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;menu&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt; (
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;MenuLayout ctx&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{ctx} PageContent&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{PageContent} &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					) &lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; (
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;DocLayout ctx&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{ctx} PageContent&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{PageContent} &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					)}
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
	)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;interactive-components&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#interactive-components&quot; aria-label=&quot;Link to interactive-components&quot;&gt;&lt;/a&gt;Interactive Components&lt;/h2&gt;
&lt;p&gt;For pages requiring complex interactivity (e.g., contact forms), we recommend using client-only components. Your theme can provide these in its &lt;code&gt;components/&lt;/code&gt; directory (e.g., &lt;code&gt;ContactForm.client.jsx&lt;/code&gt;), which users can then drop into their MDX pages.&lt;/p&gt;
&lt;h2 id=&quot;standalone-html-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#standalone-html-pages&quot; aria-label=&quot;Link to standalone-html-pages&quot;&gt;&lt;/a&gt;Standalone HTML Pages&lt;/h2&gt;
&lt;p&gt;Special-purpose pages are not limited to MDX. You can include pure &lt;code&gt;.html&lt;/code&gt; files in your theme&amp;#039;s &lt;code&gt;pagesDir&lt;/code&gt;. Their local scripts, styles, and assets are processed by Rsbuild before output.&lt;/p&gt;
&lt;p&gt;This approach is excellent for standalone landing pages or embedded tools that should omit standard documentation elements like sidebars or ToCs. You can use &lt;code&gt;ctx.page.path.endsWith(&amp;#039;.html&amp;#039;)&lt;/code&gt; within your template to apply a &amp;quot;standalone&amp;quot; layout.&lt;/p&gt;
&lt;h2 id=&quot;path-and-asset-resolution&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#path-and-asset-resolution&quot; aria-label=&quot;Link to path-and-asset-resolution&quot;&gt;&lt;/a&gt;Path and Asset Resolution&lt;/h2&gt;
&lt;p&gt;Methanol automatically resolves asset paths during the build process. While &lt;code&gt;withBase()&lt;/code&gt; is generally not required for theme-provided static assets in &lt;code&gt;public/&lt;/code&gt;, it remains a reliable tool for generating dynamic URLs that must remain base-path aware across different environments.&lt;/p&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:18:31.504Z</updated></entry><entry><title>Themes</title><link href="https://methanol.sudomaker.com/advanced/themes/"/><id>https://methanol.sudomaker.com/advanced/themes/</id><summary>Theme object shape, default directories, and the template contract.</summary><content type="html">&lt;h1 id=&quot;themes&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#themes&quot; aria-label=&quot;Link to themes&quot;&gt;&lt;/a&gt;Themes&lt;/h1&gt;
&lt;p&gt;Themes control layout (HTML template), default MDX components, and optional theme pages/assets. The default theme in the Methanol repo is a good reference.&lt;/p&gt;
&lt;h2 id=&quot;theme-implementation-guide&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-implementation-guide&quot; aria-label=&quot;Link to theme-implementation-guide&quot;&gt;&lt;/a&gt;Theme Implementation Guide&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/&quot;&gt;Theme guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/navigation&quot;&gt;Render navigation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/toc&quot;&gt;Render a ToC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/prev-next&quot;&gt;Prev/next links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/language-switch&quot;&gt;Language switch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;../theme-guide/special-pages&quot;&gt;Special-purpose pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;./blog&quot;&gt;Blog theme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;theme-shape&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-shape&quot; aria-label=&quot;Link to theme-shape&quot;&gt;&lt;/a&gt;Theme Shape&lt;/h2&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	theme&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		root&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./theme&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		componentsDir&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./components&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		pagesDir&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./pages&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		publicDir&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./public&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		sources&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;/theme&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./sources&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
		},
		&lt;span class=&quot;pl-en&quot;&gt;template&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ PageContent, ExtraHead, ctx, page, withBase, HTMLRenderer, components }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&amp;gt;&lt;/span&gt;
				{&lt;span class=&quot;pl-smi&quot;&gt;HTMLRenderer&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;rawHTML&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&amp;lt;!doctype html&amp;gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&lt;/span&gt;}
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;html lang&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;en&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;meta charset&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;UTF-8&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;meta name&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;viewport&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; content&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;width=device-width&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;ExtraHead &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;site&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;name&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;title&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;link rel&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;icon&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; href&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;/favicon.png&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;head&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
						{&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;Hi&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;components&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;}
						&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;PageContent &lt;span class=&quot;pl-k&quot;&gt;/&amp;gt;&lt;/span&gt;
					&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;body&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
				&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;html&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
			&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
		),
		components&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			&lt;span class=&quot;pl-en&quot;&gt;Callout&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; ({ children }) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div &lt;span class=&quot;pl-k&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;callout&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{children}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
		}
	}
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;required&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#required&quot; aria-label=&quot;Link to required&quot;&gt;&lt;/a&gt;Required&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;theme.root&lt;/code&gt; is required and defines the base directory for theme paths.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;defaults-and-validation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#defaults-and-validation&quot; aria-label=&quot;Link to defaults-and-validation&quot;&gt;&lt;/a&gt;Defaults and Validation&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;componentsDir&lt;/code&gt;, &lt;code&gt;pagesDir&lt;/code&gt;, &lt;code&gt;publicDir&lt;/code&gt; can be:
&lt;ul&gt;
&lt;li&gt;omitted (defaults to &lt;code&gt;./components&lt;/code&gt;, &lt;code&gt;./pages&lt;/code&gt;, &lt;code&gt;./public&lt;/code&gt; under the theme root; missing dirs are skipped)&lt;/li&gt;
&lt;li&gt;set to &lt;code&gt;false&lt;/code&gt; (disables that feature for the theme)&lt;/li&gt;
&lt;li&gt;set explicitly (must exist or Methanol throws)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;theme-layout-files&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-layout-files&quot; aria-label=&quot;Link to theme-layout-files&quot;&gt;&lt;/a&gt;Theme Layout Files&lt;/h2&gt;
&lt;p&gt;Suggested structure:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code&gt;theme/
  index.js          # exports the theme object
  page.jsx          # template component
  components/       # default MDX components
  pages/            # optional theme pages
  public/           # optional public assets
  sources/          # assets mapped by theme.sources
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Theme &lt;code&gt;public/&lt;/code&gt; is merged into the project &lt;code&gt;publicDir&lt;/code&gt; during dev/build. If a path exists in both, the project asset wins.&lt;/p&gt;
&lt;h2 id=&quot;template-contract&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#template-contract&quot; aria-label=&quot;Link to template-contract&quot;&gt;&lt;/a&gt;Template Contract&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;theme.template&lt;/code&gt; receives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;PageContent&lt;/code&gt;: JSX component for the current page content&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ExtraHead&lt;/code&gt;: extra &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; content (page assets + Methanol runtime + per-page &lt;code&gt;&amp;lt;Head&amp;gt;&lt;/code&gt;/&lt;code&gt;head&lt;/code&gt; output)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx&lt;/code&gt;: page/site context (&lt;code&gt;ctx.page&lt;/code&gt;, &lt;code&gt;ctx.pages&lt;/code&gt;, &lt;code&gt;ctx.pagesTree&lt;/code&gt;, &lt;code&gt;ctx.pagesByRoute&lt;/code&gt;, &lt;code&gt;ctx.languages&lt;/code&gt;, &lt;code&gt;ctx.language&lt;/code&gt;, &lt;code&gt;ctx.site&lt;/code&gt;, &lt;code&gt;ctx.withBase&lt;/code&gt;, &lt;code&gt;ctx.routePath&lt;/code&gt;, &lt;code&gt;ctx.routeHref&lt;/code&gt;, &lt;code&gt;ctx.path&lt;/code&gt;, &lt;code&gt;ctx.getSiblings&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;page&lt;/code&gt;: alias for &lt;code&gt;ctx.page&lt;/code&gt;, providing page info&lt;/li&gt;
&lt;li&gt;&lt;code&gt;withBase&lt;/code&gt;: helper for base-aware URLs (same function as &lt;code&gt;ctx.withBase&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;HTMLRenderer&lt;/code&gt;: refui HTML renderer (for &lt;code&gt;rawHTML&lt;/code&gt;/&lt;code&gt;serialize&lt;/code&gt;, or for manually rendering JSX components)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;components&lt;/code&gt;: merged components object (theme components + user components)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Return a JSX tree.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; put &lt;code&gt;&amp;lt;ExtraHead /&amp;gt;&lt;/code&gt; inside &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;. Without it, per-page &lt;code&gt;&amp;lt;Head&amp;gt;&lt;/code&gt;/&lt;code&gt;head&lt;/code&gt; and automatic page assets won’t be injected.&lt;/p&gt;
&lt;p&gt;When your site is deployed under a subpath (&lt;code&gt;site.base !== &amp;#039;/&amp;#039;&lt;/code&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;withBase(&amp;#039;/...&amp;#039;)&lt;/code&gt; (or &lt;code&gt;ctx.withBase(&amp;#039;/...&amp;#039;)&lt;/code&gt;) for URLs that must follow the configured site/Rsbuild base, such as runtime assets.&lt;/li&gt;
&lt;li&gt;Don’t apply &lt;code&gt;withBase()&lt;/code&gt; to theme source URLs (&lt;code&gt;theme.sources&lt;/code&gt;) or plain static files under &lt;code&gt;public/&lt;/code&gt;; Methanol resolves those paths directly.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;theme-components&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-components&quot; aria-label=&quot;Link to theme-components&quot;&gt;&lt;/a&gt;Theme Components&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;theme.components&lt;/code&gt; provides default MDX components. User components in the project &lt;code&gt;components/&lt;/code&gt; override theme components by name.&lt;/p&gt;
&lt;p&gt;The template also receives &lt;code&gt;components&lt;/code&gt;, which is the merged result (useful for layout-level components like nav/search).&lt;/p&gt;
&lt;h2 id=&quot;theme-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-pages&quot; aria-label=&quot;Link to theme-pages&quot;&gt;&lt;/a&gt;Theme Pages&lt;/h2&gt;
&lt;p&gt;Theme pages follow the same routing rules as user pages. User routes always override theme routes.&lt;/p&gt;
&lt;p&gt;A theme-provided &lt;code&gt;/404&lt;/code&gt; is used only when the user project does not define its own 404 page.&lt;/p&gt;
&lt;h2 id=&quot;theme-public-assets&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-public-assets&quot; aria-label=&quot;Link to theme-public-assets&quot;&gt;&lt;/a&gt;Theme Public Assets&lt;/h2&gt;
&lt;p&gt;If the theme provides a &lt;code&gt;publicDir&lt;/code&gt;, Methanol copies its files into the user public directory at dev/build start. When the user sets &lt;code&gt;publicDir&lt;/code&gt;, theme files are still copied into it; files with the same name are skipped. If the user does not have a public directory, Methanol falls back to the theme public directory.&lt;/p&gt;
&lt;h2 id=&quot;theme-sources&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-sources&quot; aria-label=&quot;Link to theme-sources&quot;&gt;&lt;/a&gt;Theme Sources&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;theme.sources&lt;/code&gt; maps virtual URLs to files. This is handled by Methanol’s resolver rather than Rsbuild aliases.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;default&lt;/span&gt; () &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; ({
	theme&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
		root&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./theme&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;,
		sources&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {
			&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;/theme&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;./sources&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;
		}
	}
})
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;theme-hooks&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#theme-hooks&quot; aria-label=&quot;Link to theme-hooks&quot;&gt;&lt;/a&gt;Theme Hooks&lt;/h2&gt;
&lt;p&gt;A theme can also provide build hooks (same shape as user config hooks):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;preBuild&lt;/code&gt; (dev startup + before build)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;preBundle&lt;/code&gt; (after pages are rendered, before Rsbuild bundles)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postBundle&lt;/code&gt; (after Rsbuild bundles, before HTML asset rewriting)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;postBuild&lt;/code&gt; (after build)&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:18:31.503Z</updated></entry><entry><title>Routing</title><link href="https://methanol.sudomaker.com/guide/routing"/><id>https://methanol.sudomaker.com/guide/routing</id><summary>Specifications for file-based routing of pages and directories.</summary><content type="html">&lt;h1 id=&quot;routing&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#routing&quot; aria-label=&quot;Link to routing&quot;&gt;&lt;/a&gt;Routing&lt;/h1&gt;
&lt;p&gt;Methanol automatically constructs a routing hierarchy based on the structure of the &lt;code&gt;pages/&lt;/code&gt; directory.&lt;/p&gt;
&lt;h2 id=&quot;mdx-and-markdown-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#mdx-and-markdown-pages&quot; aria-label=&quot;Link to mdx-and-markdown-pages&quot;&gt;&lt;/a&gt;MDX and Markdown Pages&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pages/about.mdx&lt;/code&gt; → &lt;code&gt;/about&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pages/guide/index.mdx&lt;/code&gt; → &lt;code&gt;/guide/&lt;/code&gt; (directory index)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;html-pages&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#html-pages&quot; aria-label=&quot;Link to html-pages&quot;&gt;&lt;/a&gt;&lt;code&gt;.html&lt;/code&gt; Pages&lt;/h2&gt;
&lt;p&gt;Plain HTML files can also be placed within the &lt;code&gt;pages/&lt;/code&gt; directory. These are included in the production build and their local scripts, styles, and assets are processed by Rsbuild:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pages/custom.html&lt;/code&gt; → &lt;code&gt;dist/custom.html&lt;/code&gt; (accessible via &lt;code&gt;/custom.html&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;../custom&quot;&gt;Custom HTML page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;404-page&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#404-page&quot; aria-label=&quot;Link to 404-page&quot;&gt;&lt;/a&gt;404 Page&lt;/h2&gt;
&lt;p&gt;Create &lt;code&gt;pages/404.mdx&lt;/code&gt; to customize the &amp;quot;Not Found&amp;quot; page. This page is automatically hidden from the navigation menu.&lt;/p&gt;
&lt;h2 id=&quot;offline-page&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#offline-page&quot; aria-label=&quot;Link to offline-page&quot;&gt;&lt;/a&gt;Offline Page&lt;/h2&gt;
&lt;p&gt;Create &lt;code&gt;pages/offline.mdx&lt;/code&gt; to customize the offline fallback page utilized by the built-in PWA. This page is also hidden from navigation by default.&lt;/p&gt;
&lt;h2 id=&quot;hidden-vs-excluded&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#hidden-vs-excluded&quot; aria-label=&quot;Link to hidden-vs-excluded&quot;&gt;&lt;/a&gt;Hidden vs. Excluded&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;hidden: true&lt;/code&gt;: Hides the page from navigation menus, though the route remains active and accessible via direct URL.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclude: true&lt;/code&gt;: Completely removes the page from both development and build processes. When applied to a directory &lt;code&gt;index.mdx&lt;/code&gt;, the entire directory is excluded.&lt;/li&gt;
&lt;li&gt;Files or directories beginning with &lt;code&gt;_&lt;/code&gt; or &lt;code&gt;.&lt;/code&gt; are ignored by the system.&lt;/li&gt;
&lt;/ul&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:18:31.503Z</updated></entry><entry><title>MDX Runtime Helpers</title><link href="https://methanol.sudomaker.com/advanced/mdx-runtime"/><id>https://methanol.sudomaker.com/advanced/mdx-runtime</id><summary>Runtime helpers, context injection, and hydration behavior.</summary><content type="html">&lt;h1 id=&quot;mdx-runtime-helpers&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#mdx-runtime-helpers&quot; aria-label=&quot;Link to mdx-runtime-helpers&quot;&gt;&lt;/a&gt;MDX Runtime Helpers&lt;/h1&gt;
&lt;p&gt;Methanol automatically injects a lightweight runtime context into every MDX file, facilitating the creation of dynamic content and simplified template integration.&lt;/p&gt;
&lt;h2 id=&quot;context-variables&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#context-variables&quot; aria-label=&quot;Link to context-variables&quot;&gt;&lt;/a&gt;Context Variables&lt;/h2&gt;
&lt;p&gt;The following helpers are globally available within MDX pages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ctx&lt;/code&gt;: The complete page and site context object.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;frontmatter&lt;/code&gt;: An alias for &lt;code&gt;ctx.page.frontmatter&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rawHTML&lt;/code&gt;: A utility for injecting unescaped HTML content.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&lt;span class=&quot;pl-mh&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-mh&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-mh&quot;&gt;&lt;span class=&quot;pl-smi&quot;&gt;frontmatter&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;??&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;&lt;span class=&quot;pl-en&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-mh&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

Current Route: &lt;span class=&quot;pl-s&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routePath&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;context-structure&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#context-structure&quot; aria-label=&quot;Link to context-structure&quot;&gt;&lt;/a&gt;Context Structure&lt;/h2&gt;
&lt;p&gt;Key properties available on the &lt;code&gt;ctx&lt;/code&gt; object:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ctx.page&lt;/code&gt;: Metadata for the current page (see detailed schema below).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.pages&lt;/code&gt;: Flat list of pages for navigation (excludes &lt;code&gt;exclude: true&lt;/code&gt; and omits &lt;code&gt;/404&lt;/code&gt; + &lt;code&gt;/offline&lt;/code&gt; unless &lt;code&gt;hidden: false&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.pagesByRoute&lt;/code&gt;: &lt;code&gt;Map&lt;/code&gt; of &lt;code&gt;routePath -&amp;gt; page&lt;/code&gt; for fast lookup.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.pagesTree&lt;/code&gt;: The hierarchical navigation tree scoped to the current root.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.site&lt;/code&gt;: Site-wide metadata (e.g., &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;root&lt;/code&gt;, &lt;code&gt;pagesDir&lt;/code&gt;, &lt;code&gt;distDir&lt;/code&gt;, &lt;code&gt;pagefind&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.withBase(path)&lt;/code&gt;: A utility that prefixes URLs starting with &lt;code&gt;/&lt;/code&gt; with the configured site/Rsbuild base (relative URLs remain unchanged).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.language&lt;/code&gt;: The currently active language entry (derived from directory index pages with &lt;code&gt;lang&lt;/code&gt;; includes &lt;code&gt;label&lt;/code&gt; and &lt;code&gt;code&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.getSiblings()&lt;/code&gt;: Returns the &lt;code&gt;{ prev, next }&lt;/code&gt; page objects for the current page, respecting the active navigation root.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.routePath&lt;/code&gt; / &lt;code&gt;ctx.routeHref&lt;/code&gt;: Route information for the current page.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ctx.path&lt;/code&gt;: Absolute filesystem path for the current page.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Note: You typically do not need to use &lt;code&gt;ctx.withBase()&lt;/code&gt; for &lt;code&gt;theme.sources&lt;/code&gt; or static files in &lt;code&gt;public/&lt;/code&gt;, as Methanol resolves these at build time. However, it is a useful safeguard for URLs generated dynamically via JavaScript in development environments.&lt;/em&gt;&lt;/p&gt;
&lt;h3 id=&quot;ctxsite&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#ctxsite&quot; aria-label=&quot;Link to ctxsite&quot;&gt;&lt;/a&gt;ctx.site&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;ctx.site&lt;/code&gt; is a snapshot of site-level metadata and build flags, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;name&lt;/code&gt;, &lt;code&gt;owner&lt;/code&gt;, &lt;code&gt;base&lt;/code&gt;, &lt;code&gt;mode&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;root&lt;/code&gt;, &lt;code&gt;pagesDir&lt;/code&gt;, &lt;code&gt;componentsDir&lt;/code&gt;, &lt;code&gt;publicDir&lt;/code&gt;, &lt;code&gt;distDir&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pagefind&lt;/code&gt; (&lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;options&lt;/code&gt;, &lt;code&gt;build&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;feed&lt;/code&gt; (&lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;atom&lt;/code&gt;, &lt;code&gt;path&lt;/code&gt;, &lt;code&gt;href&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pwa&lt;/code&gt; (&lt;code&gt;enabled&lt;/code&gt;, &lt;code&gt;manifestPath&lt;/code&gt;, &lt;code&gt;manifestHref&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;generatedAt&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ctxpage-metadata-object&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#ctxpage-metadata-object&quot; aria-label=&quot;Link to ctxpage-metadata-object&quot;&gt;&lt;/a&gt;ctx.page Metadata Object&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;ctx.page&lt;/code&gt; provides comprehensive metadata for the current page. The full schema includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;routePath&lt;/code&gt;: The normalized route path (e.g., &lt;code&gt;/guide/writing&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;routeHref&lt;/code&gt;: The base-aware href for linking (includes the configured site/Rsbuild base).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;path&lt;/code&gt;: The absolute filesystem path to the source file.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;source&lt;/code&gt;: Origin of the file (&lt;code&gt;&amp;quot;user&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;theme&amp;quot;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;relativePath&lt;/code&gt;: The path relative to &lt;code&gt;pagesDir&lt;/code&gt; (including extension).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;name&lt;/code&gt;: The filename without extension.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dir&lt;/code&gt;: The directory path relative to &lt;code&gt;pagesDir&lt;/code&gt; (&lt;code&gt;&amp;#039;&amp;#039;&lt;/code&gt; for root).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;segments&lt;/code&gt;: An array of route segments.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;depth&lt;/code&gt;: The number of segments in the route.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;isIndex&lt;/code&gt;: Boolean, &lt;code&gt;true&lt;/code&gt; if the file is an &lt;code&gt;index.mdx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;title&lt;/code&gt;: The resolved page title (from frontmatter or inferred from headings).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;frontmatter&lt;/code&gt;: The parsed YAML frontmatter object.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;matter&lt;/code&gt;: Raw frontmatter block metadata.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;content&lt;/code&gt;: Raw Markdown content excluding frontmatter.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;toc&lt;/code&gt;: Extracted Table of Contents entries.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;weight&lt;/code&gt;: Numeric sort order (from frontmatter).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;date&lt;/code&gt;: Normalized ISO date string (from frontmatter).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;isRoot&lt;/code&gt;: Boolean, &lt;code&gt;true&lt;/code&gt; if the page defines a navigation root.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hidden&lt;/code&gt;: Boolean, &lt;code&gt;true&lt;/code&gt; if the page is hidden from navigation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hiddenByParent&lt;/code&gt;: String or &lt;code&gt;null&lt;/code&gt;, the nearest hidden ancestor route (e.g., &lt;code&gt;/hidden/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hiddenByParents&lt;/code&gt;: Boolean, &lt;code&gt;true&lt;/code&gt; if the page is inside any hidden section.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclude&lt;/code&gt;: Boolean, &lt;code&gt;true&lt;/code&gt; if the page is excluded from the build.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stats.size&lt;/code&gt;: File size in bytes.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stats.createdAt&lt;/code&gt;: File creation timestamp (ISO) if available.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stats.updatedAt&lt;/code&gt;: Last modified timestamp (ISO) if available.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Note: Directory index routes always include a trailing slash in &lt;code&gt;routePath&lt;/code&gt; (e.g., &lt;code&gt;/guide/&lt;/code&gt;).&lt;/em&gt;
&lt;em&gt;&lt;code&gt;ctx.page.getSiblings()&lt;/code&gt; is injected at runtime to facilitate previous/next navigation.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Usage Example:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;pl-s&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;frontmatter&lt;/span&gt;?.&lt;span class=&quot;pl-smi&quot;&gt;excerpt&lt;/span&gt;&lt;span class=&quot;pl-s&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;ctxpages-list&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#ctxpages-list&quot; aria-label=&quot;Link to ctxpages-list&quot;&gt;&lt;/a&gt;ctx.pages List&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;ctx.pages&lt;/code&gt; is a flat array containing metadata objects (matching the &lt;code&gt;ctx.page&lt;/code&gt; schema) for navigation. It excludes pages marked with &lt;code&gt;exclude: true&lt;/code&gt;, and it omits &lt;code&gt;/404&lt;/code&gt; and &lt;code&gt;/offline&lt;/code&gt; unless those pages are explicitly set to &lt;code&gt;hidden: false&lt;/code&gt;. Hidden pages may still appear here, but &lt;code&gt;ctx.pagesTree&lt;/code&gt; will filter them out.&lt;/p&gt;
&lt;p&gt;This is ideal for generating custom indices, sitemaps, or manual navigation structures:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;ul&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
  {&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;pages&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;map&lt;/span&gt;((&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
    &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;li&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;a href&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routeHref&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routePath&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;page&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;li&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
  ))}
&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;ul&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;ctxpagestree-hierarchy&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#ctxpagestree-hierarchy&quot; aria-label=&quot;Link to ctxpagestree-hierarchy&quot;&gt;&lt;/a&gt;ctx.pagesTree Hierarchy&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;ctx.pagesTree&lt;/code&gt; represents the navigation hierarchy for the current root context (adhering to &lt;code&gt;isRoot&lt;/code&gt; and &lt;code&gt;hidden&lt;/code&gt; rules). Node structure:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;type&lt;/code&gt;: &lt;code&gt;&amp;quot;page&amp;quot;&lt;/code&gt; or &lt;code&gt;&amp;quot;directory&amp;quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;title&lt;/code&gt; / &lt;code&gt;name&lt;/code&gt;: Display label.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;routePath&lt;/code&gt; / &lt;code&gt;routeHref&lt;/code&gt;: Route for the node.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;children&lt;/code&gt;: Array of child nodes (for directories).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use this to construct navigation UIs that mirror the sidebar structure:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;{&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;pagesTree&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;map&lt;/span&gt;((&lt;span class=&quot;pl-smi&quot;&gt;node&lt;/span&gt;) &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; (
  &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;node&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;node&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;name&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;div&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
))}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3 id=&quot;ctxgetsiblings-helper&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#ctxgetsiblings-helper&quot; aria-label=&quot;Link to ctxgetsiblings-helper&quot;&gt;&lt;/a&gt;ctx.getSiblings Helper&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;ctx.getSiblings()&lt;/code&gt; retrieves the preceding and succeeding pages in the current navigation sequence. It respects the active navigation root and visibility rules, ensuring consistency with the sidebar order.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;{(() &lt;span class=&quot;pl-k&quot;&gt;=&amp;gt;&lt;/span&gt; {
  &lt;span class=&quot;pl-k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;siblings&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;getSiblings&lt;/span&gt;()
  &lt;span class=&quot;pl-k&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;pl-k&quot;&gt;!&lt;/span&gt;siblings) &lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;
  &lt;span class=&quot;pl-k&quot;&gt;return&lt;/span&gt; (
    &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;nav&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
      {&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;prev&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;a href&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;prev&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routeHref&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;prev&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routePath&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;Previous&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;prev&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;}
      {&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;next&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;?&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;&lt;/span&gt;a href&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;{&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;next&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routeHref&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;next&lt;/span&gt;.&lt;span class=&quot;pl-smi&quot;&gt;routePath&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;Next&lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; {&lt;span class=&quot;pl-smi&quot;&gt;siblings&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;next&lt;/span&gt;.&lt;span class=&quot;pl-c1&quot;&gt;title&lt;/span&gt;}&lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;pl-k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pl-c1&quot;&gt;null&lt;/span&gt;}
    &lt;span class=&quot;pl-k&quot;&gt;&amp;lt;/&lt;/span&gt;nav&lt;span class=&quot;pl-k&quot;&gt;&amp;gt;&lt;/span&gt;
  )
})()}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;rawhtml-utility&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#rawhtml-utility&quot; aria-label=&quot;Link to rawhtml-utility&quot;&gt;&lt;/a&gt;rawHTML Utility&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;rawHTML&lt;/code&gt; helper allows for the injection of unescaped HTML. This is particularly useful for inline scripts or specific markup that must remain unsanitized.&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;{&lt;span class=&quot;pl-en&quot;&gt;rawHTML&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&amp;lt;span class=&amp;quot;badge&amp;quot;&amp;gt;Beta&amp;lt;/span&amp;gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;)}
{&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-en&quot;&gt;rawHTML&lt;/span&gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&amp;lt;&lt;span class=&quot;pl-ent&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;data-banner&lt;/span&gt;=&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;true&lt;span class=&quot;pl-pds&quot;&gt;&amp;quot;&lt;/span&gt;&amp;gt;Banner&amp;lt;/&lt;span class=&quot;pl-ent&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;span class=&quot;pl-pds&quot;&gt;`&lt;/span&gt;&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;rawHTML&lt;/code&gt; supports reactivity via signals and standard template interpolation.&lt;/p&gt;</content><author><name>Yukino Song</name></author><updated>2026-08-08T06:18:31.502Z</updated></entry><entry><title>Links and Navigation</title><link href="https://methanol.sudomaker.com/guide/links"/><id>https://methanol.sudomaker.com/guide/links</id><summary>Management of links, navigation structure, and internal URL resolution.</summary><content type="html">&lt;h1 id=&quot;links-and-navigation&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#links-and-navigation&quot; aria-label=&quot;Link to links-and-navigation&quot;&gt;&lt;/a&gt;Links and Navigation&lt;/h1&gt;
&lt;p&gt;Methanol utilizes a file-based routing mechanism. Internal links can be created simply by referencing the route path of the target file.&lt;/p&gt;
&lt;h2 id=&quot;internal-links&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#internal-links&quot; aria-label=&quot;Link to internal-links&quot;&gt;&lt;/a&gt;Internal Links&lt;/h2&gt;
&lt;p&gt;Reference site routes without file extensions:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-md&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;[&lt;/span&gt;Writing Basics&lt;span class=&quot;pl-s&quot;&gt;](&lt;span class=&quot;pl-corl&quot;&gt;./writing&lt;/span&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Rendered result: &lt;a href=&quot;./writing&quot;&gt;Writing Basics&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If a page is moved or renamed, ensure that any links pointing to it are updated accordingly.&lt;/p&gt;
&lt;h3 id=&quot;subpath-deployments-sitebase&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#subpath-deployments-sitebase&quot; aria-label=&quot;Link to subpath-deployments-sitebase&quot;&gt;&lt;/a&gt;Subpath Deployments (&lt;code&gt;site.base&lt;/code&gt;)&lt;/h3&gt;
&lt;p&gt;If your site is hosted under a subpath (e.g., &lt;code&gt;https://example.com/docs/&lt;/code&gt;), ensure &lt;code&gt;site.base: &amp;#039;/docs/&amp;#039;&lt;/code&gt; is configured. In such cases, avoid using root-absolute links like &lt;code&gt;/blog/post&lt;/code&gt; within your content.&lt;/p&gt;
&lt;p&gt;Relative linking is recommended:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-md&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;[&lt;/span&gt;Next post&lt;span class=&quot;pl-s&quot;&gt;](&lt;span class=&quot;pl-corl&quot;&gt;./next-post&lt;/span&gt;)&lt;/span&gt;
&lt;span class=&quot;pl-s&quot;&gt;[&lt;/span&gt;Back to blog&lt;span class=&quot;pl-s&quot;&gt;](&lt;span class=&quot;pl-corl&quot;&gt;../blog/&lt;/span&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you need to generate a root-absolute link within MDX or JSX, wrap the path with &lt;code&gt;ctx.withBase&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-mdx&quot;&gt;&amp;lt;&lt;span class=&quot;pl-ent&quot;&gt;a&lt;/span&gt; &lt;span class=&quot;pl-e&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;pl-k&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;pl-pse&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pl-smi&quot;&gt;ctx&lt;/span&gt;.&lt;span class=&quot;pl-en&quot;&gt;withBase&lt;/span&gt;(&lt;span class=&quot;pl-s&quot;&gt;&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;/blog/post&lt;span class=&quot;pl-pds&quot;&gt;&amp;#039;&lt;/span&gt;&lt;/span&gt;)&lt;span class=&quot;pl-pse&quot;&gt;}&lt;/span&gt;&amp;gt;Read&amp;lt;/&lt;span class=&quot;pl-ent&quot;&gt;a&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2 id=&quot;external-links&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#external-links&quot; aria-label=&quot;Link to external-links&quot;&gt;&lt;/a&gt;External Links&lt;/h2&gt;
&lt;p&gt;For external destinations, use fully qualified URLs:&lt;/p&gt;
&lt;div class=&quot;code-block-container&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-md&quot;&gt;&lt;span class=&quot;pl-s&quot;&gt;[&lt;/span&gt;Example&lt;span class=&quot;pl-s&quot;&gt;](&lt;span class=&quot;pl-corl&quot;&gt;https://example.com&lt;/span&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Rendered result: &lt;a href=&quot;https://example.com&quot;&gt;Example&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;navigation-hierarchy&quot;&gt;&lt;a class=&quot;heading-anchor&quot; href=&quot;#navigation-hierarchy&quot; aria-label=&quot;Link to navigation-hierarchy&quot;&gt;&lt;/a&gt;Navigation Hierarchy&lt;/h2&gt;
&lt;p&gt;Use Frontmatter properties to control the configured order and visibility of pages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;weight&lt;/code&gt;: Lower numerical values are positioned higher in the navigation.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;hidden&lt;/code&gt;: Excludes the page from the sidebar menu.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;isRoot&lt;/code&gt;: Defines an &lt;code&gt;index.mdx&lt;/code&gt; file as the root of a navigation sub-tree.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For complete specifications, refer to the &lt;a href=&quot;../reference/frontmatter&quot;&gt;Frontmatter Reference&lt;/a&gt;.&lt;/p&gt;</content><author><name>Yukino Song</name></author><updated>2026-06-25T22:36:39.961Z</updated></entry></feed>