<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Hugo 模块 on Hugo 中文文档</title>
    <link>https://hugozh.cn/hugo-modules/</link>
    <description>Recent content in Hugo 模块 on Hugo 中文文档</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Fri, 02 Oct 2026 01:21:54 +0800</lastBuildDate>
    <atom:link href="https://hugozh.cn/hugo-modules/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>简介</title>
      <link>https://hugozh.cn/hugo-modules/introduction/</link>
      <pubDate>Thu, 01 Oct 2026 00:00:00 +0800</pubDate>
      <guid>https://hugozh.cn/hugo-modules/introduction/</guid>
      <description>&lt;h2 id=&#34;模块是什么&#34;&gt;模块是什么&lt;/h2&gt;&#xA;&lt;p&gt;Hugo 用模块（module）作为最基本的组织单位。一个模块既可以是一个完整的 Hugo 项目，也可以是更小的、可复用的片段，用来提供 Hugo 七类组件（component）中的一类或几类：&lt;/p&gt;</description>
    </item>
    <item>
      <title>使用模块</title>
      <link>https://hugozh.cn/hugo-modules/use-modules/</link>
      <pubDate>Thu, 01 Oct 2026 00:00:00 +0800</pubDate>
      <guid>https://hugozh.cn/hugo-modules/use-modules/</guid>
      <description>&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;注意&lt;/strong&gt;：要与模块打交道，必须安装 &lt;a href=&#34;https://git-scm.com/book/en/v2/Getting-Started-Installing-Git&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Git&lt;/a&gt; 与 &lt;a href=&#34;https://go.dev/doc/install&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Go&lt;/a&gt; 1.18 或更高版本。&lt;/p&gt;&lt;/blockquote&gt;&lt;h2 id=&#34;模块概览&#34;&gt;模块概览&lt;/h2&gt;&#xA;&lt;p&gt;模块（module）是 Hugo 的基本组织单位，使用时需要了解几条规则：&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;模块可以按任意组合与顺序导入。&lt;/li&gt;&#xA;&lt;li&gt;模块导入是递归的：导入模块 A 可能连带触发对模块 B 的导入，依此类推。&lt;/li&gt;&#xA;&lt;li&gt;模块可以提供配置文件与目录，但要遵守配置合并相关的约束。&lt;/li&gt;&#xA;&lt;li&gt;外部目录——包括来自非 Hugo 项目的目录——可以挂载进来，从而形成统一的文件系统。&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;导入模块&#34;&gt;导入模块&lt;/h2&gt;&#xA;&lt;p&gt;要导入模块，先要把项目本身初始化为模块。例如：&lt;/p&gt;</description>
    </item>
    <item>
      <title>主题组件</title>
      <link>https://hugozh.cn/hugo-modules/theme-components/</link>
      <pubDate>Thu, 01 Oct 2026 00:00:00 +0800</pubDate>
      <guid>https://hugozh.cn/hugo-modules/theme-components/</guid>
      <description>&lt;h2 id=&#34;把主题组合起来&#34;&gt;把主题组合起来&lt;/h2&gt;&#xA;&lt;p&gt;一个项目可以把主题配置为任意多个主题组件（theme component）的组合：&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;theme&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;my-shortcodes&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;base-theme&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;hyde&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;这种组合还可以嵌套：主题组件本身也能在自己的 &lt;code&gt;hugo.toml&lt;/code&gt; 中引入其他主题组件，这就是主题继承（theme inheritance）。&lt;/p&gt;</description>
    </item>
    <item>
      <title>Node.js 依赖</title>
      <link>https://hugozh.cn/hugo-modules/nodejs-dependencies/</link>
      <pubDate>Thu, 01 Oct 2026 00:00:00 +0800</pubDate>
      <guid>https://hugozh.cn/hugo-modules/nodejs-dependencies/</guid>
      <description>&lt;h2 id=&#34;为什么需要合并&#34;&gt;为什么需要合并&lt;/h2&gt;&#xA;&lt;p&gt;需要 Node 包（例如为了 Tailwind CSS）的模块，可以在模块根目录用一份标准的 &lt;code&gt;package.json&lt;/code&gt; 声明这些依赖。Hugo 会把所有模块的依赖汇总到一个 npm 工作区（npm workspace）中，因此项目层面只需要执行一次 &lt;code&gt;npm install&lt;/code&gt;。&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
