多语言支持与语言切换器,通过 i18n 语言文件扩展翻译
hugo-statnmap-theme — Hugo 博客模板
作者 statnmap
基于 Icarus 主题改造的 Hugo 多语言博客模板,包含评论、代码高亮与折叠、引用卡片、联系表单和侧边栏小工具。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
目前有 1 张原始预览,可打开完整图片查看设计细节。
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
Utterances 评论系统,可在单篇文章中关闭
highlight.js 语法高亮与代码折叠,折叠按钮支持多语言
文章底部提供引用卡片与相关文章区块
侧边栏小工具:最近文章、分类、标签、标签云
联系表单通过 Formspree 代理发送邮件
模板详细介绍
hugo-statnmap-theme 是一个面向博客与自由职业者个人站点的 Hugo 主题,由 Icarus(Hexo)主题经 hugo-icarus-theme 移植并大幅调整视觉后形成,外观参考 WordPress Twenty Fifteen。主题提供多语言支持与语言切换,评论系统接入 Utterances,正文支持语法高亮、代码折叠、LaTeX/MathML 公式渲染,文章底部可显示引用卡片与相关文章,并带有联系表单和可选的侧边栏小工具。
使用上,主题要求 Hugo 版本高于 v0.139.2,仓库内 exampleSite 通过自定义 themesDir 指向上级目录以便独立预览;若把其 config.toml 复制到常规 Hugo 站点根目录,需要注释掉 themesDir,否则 Hugo 会找不到主题。多语言通过 i18n 目录下的语言文件扩展,语言切换器需要为英语、法语之外的语言在 static/flags 放置 lang.png 旗帜图片。
功能开关多集中在 config.toml 与文章 frontmatter:可关闭评论、日期行、上一篇/下一篇链接、MathJax、highlight.js、代码折叠与引用卡片,也可在单页禁用左侧个人资料或右侧小工具。联系表单依赖 Formspree 作为静态站点的邮件代理,需自行填写端点并完成确认;示例站点中的法语菜单因缺少 .fr.md 内容可能指向 404 页面。
适合你的项目吗?
适用场景
- 搭建个人多语言博客或自由职业者作品展示站点
- 撰写含代码块与公式的技术文章,需要高亮、折叠和 MathJax 渲染
- 希望以 GitHub Issues 作为评论存储的静态博客
- 需要独立联系页面并接受访客来信的个人站点
适合人群
- 使用 Hugo 且版本高于 v0.139.2 的博客作者
- 需要中英或多语言内容与语言切换的站点
- 接受使用 Utterances 与 Formspree 等外部服务的用户
- 偏好左侧个人资料加右侧小工具布局的写作者
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
在 Hugo 站点的 themes 目录下 git clone 本主题仓库
- 2
将 exampleSite 中的 config.toml 与 i18n 等文件复制到站点根目录;用于生产时需注释掉 themesDir 属性
- 3
评论需在 config.toml 中填写 Utterances 对应的 GitHub 仓库 handle/repo
- 4
联系表单需在 contact/index.md 中填写 Formspree 端点并完成邮箱确认
- 5
英语、法语之外的语言需在 static/flags 放置名为 lang.png 的旗帜图片
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- README 提及 Formspree 表单服务;真实提交需配置服务端点,其使用额度与费用需单独核对。
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 使用该主题要求 Hugo 版本高于 v0.139.2,低于此版本无法正常运行。
- 若将 exampleSite 的 config.toml 复制到常规 Hugo 站点根目录,必须注释掉 themesDir 属性,否则 Hugo 找不到主题,无法用于生产。
- 评论功能依赖第三方服务 Utterances,需提供 GitHub 仓库 handle/repo 才能同步评论。
- 联系表单依赖第三方服务 Formspree 代理发送邮件,免费额度为每月最多一千封。
- 使用 Formspree 联系表单需自行发送测试邮件并完成账号确认。
- 英语、法语之外的语言切换需在 static/flags 目录放置名为 lang.png 的旗帜图片。
- 示例站点缺少 .fr.md 内容,法语菜单项可能跳转到 404 页面。
- 数学公式渲染依赖外部 MathJax CDN,需在 config.toml 中配置 CDN 与版本。
- 代码语法高亮依赖外部 highlight.js 库,可在 config.toml 中配置版本、CDN 与主题。
- 代码折叠功能依赖外部 Bootstrap JavaScript 库。
- 启用 SEO 需在 config.toml 或 config.yaml 中手动添加 Google Analytics、robots、canonifyURLs 等参数。
- SEO 配置需登录 Google Search Console 并验证站点所有权。
- SEO 配置还需登录 Bing Webmaster Console 添加并验证站点。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
*Requires Hugo version > v0.139.2*
README 原文
**Due to the customized `themesDir` path Hugo will fail to find themes if you copied the `config.toml` into the root directory of a regular Hugo website.** Make sure you comment out the `themesDir` property if you use the theme in production.
README 原文
The optional comment system is powered by Utterances. Enter the GitHub repository `"handle/repo"` where comments will be synced.
README 原文
Since this page will be static, you can use formspree.io as proxy to send the actual email. Each month, visitors can send you up to one thousand emails without incurring extra charges.
README 原文
Send a dummy email yourself to confirm your account
README 原文
You can add png images of flags named ‘lang.png’ in ‘static/flags’ folder, for new languages other than English and French.
README 原文
However, as no posts, itemized or contacts are saved with `.fr.md` extension in this exampleSite, menu items may redirect to the `404 not found` page.
README 原文
MathJax CDN and versions can be modified in the `config.toml` file:
README 原文
Syntax highlighting for code is allowed with `highlight.js`.
README 原文
It uses somes javascript libraries of [bootstrap](https://getbootstrap.com/docs/3.3/javascript/).
README 原文
If you wish to enable SEO on this theme, follow these instructions: 1. To include the following parameters in your *config.toml* or *config.yaml*
README 原文
Add your website to Google Search Console:
README 原文
https://github.com/statnmap/hugo-statnmap-theme/blob/master/LICENSE.mdhttps://github.com/statnmap/hugo-statnmap-theme/blob/master/README.mdAdd your website to Bing
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- GitHub
- 资料与维护参考分
- 资料一般 · 65 / 100
- 技术栈
- Hugo
- 网站类型
- 博客
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2025-04-06
- 截图检查日期
- 2026-10-04
目前没有记录演示链接。请依据仓库说明在本地评估;仅凭截图无法确认交互行为。
目录记录的主要技术栈是 Hugo。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: 76661c8442d219961d67f1879a60ac8c085dde275771f55118e3af4ec9e0e83c
2026-10-04T11:20:19.260Z
来源文件 / 仓库
# StatnMap Hugo theme
StatnMap theme is issued from [hugo-icarus-theme by
digitalcraftsman](https://github.com/digitalcraftsman/hugo-icarus-theme),
but I thought visual changes were to big to keep it as a fork. This is a
responsive and customizable theme for bloggers and freelancers. It’s
originally a port of the Icarus theme for [Hexo](//hexo.io) made by
[Ruipeng Zhang](https://github.com/ppoffice). The theme has been
revamped to look like wordpress twenty-fifteen theme.
Noteworthy features of this Hugo theme are the integration of a
comment-system powered by **Utterances**, **multilingual** support and
**language switch**, **syntax highlighting** and **code folding** for
source code, **how-to-cite card** and **related articles** sections on
bottom of articles, **contact form** and optional widgets for the
sidebar.

*Requires Hugo version > v0.139.2* You can see a live example here:
<https://statnmap.com>
## Table of Contents
<!-- TOC depthFrom:2 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 -->
- [Table of Contents](#table-of-contents)
- [Get the theme](#get-the-theme)
- [Setup](#setup)
- [Comments](#comments)
- [Menu](#menu)
- [Sidebars](#sidebars)
- [Tell me who you are](#tell-me-who-you-are)
- [Widgets](#widgets)
- [Date line](#date-line)
- [Multilanguage](#multilingual)
- [Contact form](#contact-form)
- [Linking thumbnails](#linking-thumbnails)
- [Mathematical equations](#mathematical-equations)
- [Syntax highlighting](#syntax-highlighting)
- [Code Folding](#code-folding)
- [Sticky list pages](#sticky-list-pages)
- [Gallery shortcode](#gallery-shortcode)
- [Citation card](#citation)
- [Related articles](#related-articles)
- [Website SEO](#website-seo)
- [Nearly finished](#nearly-finished)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgements](#acknowledgements)
## Get the theme
I assume you’ve Git installed. Inside the folder of your Hugo site run
$ cd themes
$ git clone https://github.com/statnmap/hugo-statnmap-theme.git
You should see a folder called `hugo-statnmap-theme` inside the `themes`
directory that we created a few moments ago. For more information read
the official [setup guide](https://gohugo.io/overview/installing/) of
Hugo.
## Setup
Next, navigate to the `exampleSite` folder at
`themes/hugo-type-theme/exampleSite/`. In order to get your site
running, you need to copy `config.toml` and all the content of all
relevant subfolders such as `i18n/en.toml` into the root folders.
To turn the `exampleSite` folder in a standalone demo site the
`themesDir` property has been set to `../..`. This way you can preview
this theme by running `hugo server` inside `exampleSite` folder.
**Due to the customized `themesDir` path Hugo will fail to find themes
if you copied the `config.toml` into the root directory of a regular
Hugo website.** Make sure you comment out the `themesDir` property if
you use the theme in production.
## The config file
Now, let us take a look into the `config.toml`. Feel free to play around
with the settings.
### Comments
The optional comment system is powered by Utterances. Enter the GitHub repository `"handle/repo"` where comments will be synced.
utteranceGitHubRepo = ""
Tip: you can disable the comment section for a single page in its
frontmatter:
``` toml
+++
disable_comments = true
+++
```
### Menu
You can also define the items menu entries as you like. First, let us
link a post that you’ve written. We can do this in the frontmatter of
the post’s content file by setting `menu` to `main`.
+++
menu = "main"
+++
Furthermore, we can add entries that don’t link to posts. Back in the
`config.toml` you’ll find a section for the menus:
[[params.menu]]
before = true
label = "Home"
link = "/"
Define a label and enter the URL to resource you want to link. With
`before` you can decide whether the link should appear before **or**
after all linked posts in the menu. Therefore, `Home` appears before the
linked post.
### Sidebars
In order to use the full width of the website you can disable the
profile on the left and / or the widgets on the right for a single page
in the frontmatter:
``` toml
+++
disable_profile = true
disable_widgets = true
+++
```
### Tell me who you are
This theme also provides a profile section on the left. Add your social
network accounts to the profile section on the left by entering your
username under `params.social`. The links to your account will be created
automatically.
### Widgets
Beside the profile section you can add widgets on the right sidebar. The
following widgets are available:
- recent articles
- category list
- tag list
- tag cloud
You can deactivate them under `params.widgets`:
[params.widgets]
recent_articles = false
categories = true
tags = true
tag_cloud = true
### Date line
The date line includes: post date, \# of words, approximate reading,
time tags and categories. However, if you want certain pages to omit the
date line, simply put `nodateline = true` in the front matter for that
page.
### Disable Previous / next article links
To disable the inclusion of a previous/next article link at the bottom
of the page, add `noprevnext = true` to the front matter. This feature,
along with `nodateline` can be used to create standalone pages that are
less “blog-like”
## Multilingual
You don’t blog in English and you want to translate the theme into
different language? No problem. Take a look in the `i18n` folder and
you’ll find a file `en.toml`. It contains all strings related to the
theme. Copy this file, change the name so that it reflects the
translation language (like `fr.toml`) and modify the strings needed.
A language switcher is also available with multilingual website
activated. You can add png images of flags named ‘lang.png’ in
‘static/flags’ folder, for new languages other than English and French.
The `config.toml` file in `exampleSite` proposes menus for a second
language (French). However, as no posts, itemized or contacts are saved
with `.fr.md` extension in this exampleSite, menu items may redirect to
the `404 not found` page.
If you only have one language for your website, you can remove every
`Languages`, `Languages.en` and `Languages.fr` occurrences. Simple
`[menu.main]` have to be used instead.
Credit: [statnmap](https://github.com/statnmap)
## Contact form
Since this page will be static, you can use formspree.io as proxy to
send the actual email. Each month, visitors can send you up to one
thousand emails without incurring extra charges. Begin the setup by
following the steps below:
1. Enter your formspree endpoint with email address under ‘emailservice’ in contact/index.md file
2. Fill the other `contactxx` fields in the frontmatter of the contact page
3. Send a dummy email yourself to confirm your account
4. Click the confirm link in the email from formspree.io
5. You’re done. Happy mailing!
Credit: [statnmap](https://github.com/statnmap)
## Linking thumbnails
After creating a new post you can define a banner by entering the
relative path to the image.
banner = "banners/placeholder.png"
Credit: [digitalcraftsman](//github.com/digitalcraftsman)
A thumbnail will be used for the recent\_articles list in the sidebar as
well as in the normal list of articles. If you want a specific thumbnail
instead of the banner croped, you can define it by entering the relative
path to the thumbnail.
thumbnail = "banners/thumbnail.png"
This way you can store them either next to the content file or in the
`static` folder.
Credit: [statnmap](https://github.com/statnmap)
## Mathematical equations
Mathematical equations in form of LaTeX or MathML code can be rendered
with the support of [MathJax](https://www.mathjax.org). MathML works out
of the box. If you’re using LaTeX you need to wrap your equation with
`$$`.
You can also print formulas inline. In this case wrap the formula only
once with `$`.
If you don’t need equations, you can disable MathJax but putting
`disable_mathjax = true` in your config.toml. This will prevent clients
from unnecessarily downloading the MathJax library.
MathJax CDN and versions can be modified in the `config.toml` file:
MathJaxCDN = "//cdn.bootcss.com"
MathJaxVersion = "2.7.1"
## Syntax highlighting
Syntax highlighting for code is allowed with `highlight.js`. This can be
disabled in the `config.toml`. Version, additional languages, CDN and
theme can also be modified.
disable_highlight = false
highlightjsVersion = "9.11.0"
highlightjsCDN = "//cdn.bootcss.com"
highlightjsLang = ["r", "yaml"]
highlightjsTheme = "github"
Credit: [yihui](https//github.com/yihui)
[statnmap](https://github.com/statnmap)
## Code folding
Code folding is enabled by default with `disable_codefolding = false` in
parameters of the `config` file. It uses somes javascript libraries of
[bootstrap](https://getbootstrap.com/docs/3.3/javascript/). Code folding
(multilingual) buttons only appear when there is code in the document
rendered from `Rmd` in blogdown. `disable_codefolding` can also be used
in each article config header. Similarly, you can define if code blocks
are shown or hidden by default using `codefolding_show = "hide"` in the
config file or in each article config.
The list of `<pre>` blocks on which to apply code folding is defined in
the `config` file:
`codeblocks = ["pre.sourceCode", "pre.r", "pre.python"]`
Credit: [statnmap](https://github.com/statnmap)
## Sticky list pages
A special kind of posts list is implemented. This allows to show the
first article completely and the other articles as a list with
summaries. For that, we use the implemented template
`list_first_plain_sticky.html` in `partial`. You can use it in two ways:
1. With Taxonomy This is implemented in the `exampleSite`.
- Create a new taxonomy like ‘sticky’:
<!-- -->
[Taxonomies]
tag = "tags"
category = "categories"
sticky = "stickies"
- Create a folder `layout` > `taxonomy`
- Create a html file named `sticky.html` with this code:
<!-- -->
{{ define "main" }}
{{ if isset .Site.Taxonomies "sticky" }}
{{ partial "list_first_plain_sticky" . }}
{{ end }}
{{ end }}
- Add taxonomy `stickies` in a post or a page. The newest page or
the page with `weight = 1` will be shown entirely before the
other of the same taxonomy (that will only show a summary). In
the exampleSite, pages in `sticky_pages` have this taxonomy.
2. With special pages
- Create a folder `layout` > `sticky_pages` for instance
- Create a html file named `list.html` with this code:
<!-- -->
{{ define "main" }}
{{ partial "list_first_plain_sticky" . }}
{{ end }}
- Create a folder `content` > `sticky_pages` (This is done in
the `exampleSite`)
- Add a page. The newest page or the page with `weight = 1` will
be shown entirely before the other of the same taxonomy (that
will only show a summary)
Credit: [statnmap](https://github.com/statnmap)
## Citation
As for [Radix](https://rstudio.github.io/radix/), a citation field can
be added to blog posts. Citation is enabled by default with
`disable_citation = false` in parameters of the `config` file. It can
also be enabled or disabled in each blog post with `disable_citation` in
the post YAML / TOML. By default author comes from blog `author` field
in the article header but `citation_author` overrides this field if
another writing is needed. `citation_author` can be specified globally
in `config` file but also for each blog post.
Code is adapted from: Yihan Wu. (2018-12-21). “Blogdown - shortcode for
radix-like Bibtex”. Retrieved from
<https://www.yihanwu.ca/post/blogdown-shortcode-generation-for-bibtex/>.
Credit: [statnmap](https://github.com/statnmap)
## Gallery shortcode
This shortcode you to easily include a gallery into your pages. Copy the
code below into your content file and enter the relative paths to your
images.
{{< gallery
"/banners/placeholder.png"
"/banners/placeholder.png"
"/banners/placeholder.png"
>}}
## Related articles
You can define parameters for related articles at the bottom of blog
posts.
[related]
# Only include matches with rank >= threshold. This is a normalized rank between 0 and 100.
threshold = 50
# To get stable "See also" sections we, by default, exclude newer related pages.
includeNewer = true
# Will lower case keywords in both queries and in the indexes.
toLower = true
[[related.indices]]
name = "keywords"
weight = 150
[[related.indices]]
name = "author"
toLower = true
weight = 30
[[related.indices]]
name = "tags"
weight = 100
[[related.indices]]
name = "date"
weight = 10
pattern = "2006"
See <https://gohugo.io/content-management/related/> for more
informations.
Credit: [statnmap](https://github.com/statnmap)
## Website SEO
This theme support SEO elements for your website. It was adapted and
integrated thanks to the following guide:
<https://keithpblog.org/post/hugo-website-seo/>
If you wish to enable SEO on this theme, follow these instructions: 1.
To include the following parameters in your *config.toml* or
*config.yaml*
# .config.toml
...
[services]
[services.googleAnalytics]
id = 'G-XXXXXXXXXX'
enableRobotsTXT = true
canonifyURLs = true
# and if you think your md file names or locations might change:
[permalinks]
post = "/blog/:title/"
...
2. Add your website to Google Search Console:
- Login to the [Google Search
Console](https://www.google.com/webmasters/tools/home)
- Add your website as property
- Add the html page as required by google to verify ownership
- Submit the sitemap (/sitemap.xml) for indexing
- Wait
3. Add your website to Bing
- Login to the [Bing Webmaster
Console](https://www.bing.com/toolbox/webmaster/)
- Add your site, details and verify
- From the 3 option, we recommend adding the xml file to you
website
## Nearly finished
In order to see your site in action, run Hugo’s built-in local server.
$ hugo server
Now enter [`localhost:4321`](http://localhost:4321) in the address bar
of your browser.
## Contributing
Have you found a bug or got an idea for a new feature? Feel free to use
the [issue tracker](//github.com/statnmap/hugo-statnmap-theme/issues) to
let me know. Or make directly a [pull
request](//github.com/statnmap/hugo-statnmap-theme/pulls).
## License
This theme is released under the MIT license. For more information read
the
[license](https://github.com/digitalcraftsman/hugo-icarus-theme/blob/master/LICENSE.md).
## Acknowledgements
Thanks to
- [Digitalcraftsman](//github.com/digitalcraftsman/hugo-icarus-theme)
for the original Hugo-icarus-theme
- [Ruipeng Zhang](//github.com/ppoffice) for creating this theme
- [Steve Francia](//github.com/spf13) for creating Hugo and the
awesome community around the project
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

hugo-PaperMod
PaperMod 是 Hugo 生态里知名度较高的主题之一,定位很明确:给博客和轻量作品集站点提供一套干净、响应式的阅读界面。
Hugo · 作品集

LoveIt
❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
Hugo · 博客

hugo-coder
A minimalist blog theme for hugo.
Hugo · 博客

blowfish
Personal Website & Blog Theme for Hugo
Hugo · 博客

hugo-paper
🪺 A simple, clean, customizable Hugo theme
Hugo · 博客

hextra
Hextra 是一个 Hugo 主题,定位在文档站与博客之间:既提供侧边栏导航、目录、面包屑、分页这类文档站结构,也能承载博客内容。
Hugo · 文档
