
* docs(blog): prepare for v0.10 release post * Update v0.10.md * Update v0.10.md to refine upgrade instructions and enhance blog features. Added synchronized tab switching and pagination controls, while improving the search experience and table of contents navigation. * Enhance v0.10 release documentation with detailed upgrade instructions and migration guide. Added Tailwind theme variable customization section and clarified breaking changes. Improved clarity on CSS class prefix changes for better user experience. * Update v0.10.md to enhance upgrade instructions, clarify breaking changes, and improve overall readability. Adjusted formatting for consistency and added details on asset management and user experience improvements. * Add notable new features to v0.10.md, including dropdown menu support, enhanced search experience, and blog list pagination. Updated FlexSearch upgrade details for clarity and improved migration guide by removing redundant breaking change notes. * chore: update zh-cn translation * chore: update ja translation * chore: update fa and ja translations * chore: prepare release
4.6 KiB
title, weight, tags, next, prev
title | weight | tags | next | prev | ||
---|---|---|---|---|---|---|
快速开始 | 1 |
|
/docs/guide | /docs |
从模板快速启动
{{< icon "github" >}} imfing/hextra-starter-template
您可以通过使用上述模板仓库快速开始。

我们提供了一个GitHub Actions工作流,可以帮助自动构建并将您的站点部署到GitHub Pages,并免费托管。 更多选项,请查看部署站点。
作为新项目启动
有两种主要方式将Hextra主题添加到您的Hugo项目中:
-
Hugo模块(推荐):最简单且推荐的方法。Hugo模块允许您直接从在线源拉取主题。主题会自动下载并由Hugo管理。
-
Git子模块:或者,将Hextra添加为Git子模块。主题由Git下载并存储在项目的
themes
文件夹中。
将Hextra设置为Hugo模块
先决条件
在开始之前,您需要安装以下软件:
步骤
{{% steps %}}
初始化一个新的Hugo站点
hugo new site my-site --format=yaml
通过模块配置Hextra主题
# 初始化Hugo模块
cd my-site
hugo mod init github.com/username/my-site
# 添加Hextra主题
hugo mod get github.com/imfing/hextra
配置hugo.yaml
以使用Hextra主题,添加以下内容:
module:
imports:
- path: github.com/imfing/hextra
创建您的内容页面
为主页和文档页面创建新内容:
hugo new content/_index.md
hugo new content/docs/_index.md
本地预览站点
hugo server --buildDrafts --disableFastRender
恭喜,您的新站点预览可在http://localhost:1313/
查看。
{{% /steps %}}
{{% details title="如何更新主题?" %}}
要更新项目中的所有Hugo模块到最新版本,运行以下命令:
hugo mod get -u
要将Hextra更新到最新发布版本,运行以下命令:
hugo mod get -u github.com/imfing/hextra
更多详情请参阅Hugo模块。
{{% /details %}}
将Hextra设置为Git子模块
先决条件
在开始之前,您需要安装以下软件:
步骤
{{% steps %}}
初始化一个新的Hugo站点
hugo new site my-site --format=yaml
将Hextra主题添加为Git子模块
切换到站点目录并初始化一个新的Git仓库:
cd my-site
git init
然后,将Hextra主题添加为Git子模块:
git submodule add https://github.com/imfing/hextra.git themes/hextra
配置hugo.yaml
以使用Hextra主题,添加以下内容:
theme: hextra
创建您的内容页面
为主页和文档页面创建新内容:
hugo new content/_index.md
hugo new content/docs/_index.md
本地预览站点
hugo server --buildDrafts --disableFastRender
您的新站点预览可在http://localhost:1313/
查看。
{{% /steps %}}
当使用CI/CD部署Hugo网站时,确保在运行hugo
命令之前执行以下命令至关重要。
git submodule update --init
如果不运行此命令,主题文件夹将不会被填充Hextra主题文件,导致构建失败。
{{% details title="如何更新主题?" %}}
要更新仓库中的所有子模块到最新提交,运行以下命令:
git submodule update --remote
要将Hextra更新到最新提交,运行以下命令:
git submodule update --remote themes/hextra
更多详情请参阅Git子模块。
{{% /details %}}
下一步
探索以下部分以开始添加更多内容:
{{< cards >}} {{< card link="../guide/organize-files" title="组织文件" icon="document-duplicate" >}} {{< card link="../guide/configuration" title="配置" icon="adjustments" >}} {{< card link="../guide/markdown" title="Markdown" icon="markdown" >}} {{< /cards >}}