hugo-to-markdown
它能做什么
这个工具可以把用 Hugo 搭建的网站和内容转换为标准的 Markdown 格式。它会读取你 Hugo 站点的配置和文件,确保转换结果准确。
适用场景
- ✓当你需要把 Hugo 网站转换为 Markdown 文件时。
- ✓当你想从 Hugo 网站中提取内容,以便在其他地方使用时。
- ✓当你要把 Hugo 网站迁移到另一个使用 Markdown 的平台时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hugo-to-markdown/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把这个 Hugo 网站转换为 Markdown,使用它本地的配置和文件。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会分析 Hugo 的配置文件(如 hugo.toml)、短代码模板以及你网站的内容。然后把这些元素转换为简洁的标准 Markdown,同时保留原始含义。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Hugo To Markdown
When to Use
Use this skill when you need convert Hugo documentation sites and Hugo-managed content into standard Markdown. Use when Agent needs to inspect a local Hugo repository, read hugo.toml or config files, content/, archetypes/, layouts/_shortcodes/, layouts/_markup/, and related docs content, then produce Markdown...
Overview
Use this skill when Markdown output must be derived from the local Hugo site, not guessed from generic Hugo knowledge. The conversion rules are the combination of Hugo's official behavior and the repository's own configuration, shortcode templates, render hooks, archetypes, and content conventions.
The target output is standard Markdown:
- Keep plain Markdown and YAML front matter.
- Replace or materialize Hugo-only constructs.
- Preserve meaning when exact rendering is not safely reproducible.
- Prefer explicit Markdown text over live Hugo template syntax.
- Distinguish literal Hugo syntax examples from active Hugo features before rewriting anything.
Official Basis
Treat the repository's own Hugo configuration and templates as the primary ruleset. For any site under conversion, inspect these rule sources in the user's provided site root:
hugo.toml(orhugo.yaml,hugo.yml,hugo.json, orconfig/*)archetypes/*data/*layouts/_shortcodes/*orlayouts/shortcodes/*layouts/_markup/*content/**
Also read any local docs that define shortcode, front matter, bundle, resource, and render-hook behavior.
Do not assume built-in Hugo defaults if the repository overrides them locally.
Workflow
1. Inventory the site before converting files
Always inspect the site-level rules first.
python3 scripts/inventory_hugo_rules.py --site-root /path/to/hugo-site
Example invocation for the user's site:
python3 skills/hugo-to-markdown/scripts/inventory_hugo_rules.py \
--site-root /path/to/your-hugo-site
This inventory step is mandatory for batch work. It identifies:
- active config files
- module mounts and content roots
- custom shortcodes
- custom render hooks
- front matter keys seen in content
- shortcode usage across content files
2. Convert with repository rules, not generic heuristics
Read references/conversion-workflow.md before changing files. Then:
- Resolve the real content root from
hugo.toml,config.*, and module mounts. - Read archetypes to understand expected front matter shape.
- Read the front matter configuration to understand date aliases, fallback order, filename-derived dates, and other inferred metadata.
- Read site data sources in
data/when shortcodes or partials pull structured content from them. - Read custom shortcode templates in
layouts/_shortcodes/orlayouts/shortcodes/. - Classify each encountered shortcode as embedded, custom, or inline, then check whether it uses named or positional arguments, block syntax, or self-closing syntax.
- Read render hooks in
layouts/_markup/. - Check whether the repo already defines Markdown- or JSON-facing export templates and partials; if it does, use those as evidence for how the site itself downgrades Hugo constructs.
- Follow
include-style shortcodes into referenced content files when the docs site composes content from shared fragments. - Convert one file or one coherent section at a time.
3. Preserve semantics during conversion
Use these rules by default:
- Keep YAML front matter unless the user explicitly asks for front-matter-free Markdown.
- Preserve core fields such as
title,description,date,draft,aliases,slug,url,weight, and nestedparamswhen they still carry meaning. - Preserve
publishDate,lastmod,expiryDate, and page resource metadata when they still affect meaning or downstream routing. - Normalize reserved Hugo front matter keys to their canonical names when the repo mixes casing, for example
Titletotitle,Descriptiontodescription, andLinkTitletolinkTitle. - Account for Hugo front matter aliases and tokens before deciding a field is unused. The official Hugo docs recognize aliases such as
pubdate,published,modified, andunpublishdate, plus tokens such as:default,:filename,:fileModTime, and:git. - Convert Hugo internal links to normal Markdown links with resolved destinations.
- Replace Hugo shortcodes with plain Markdown, HTML, or explicit notes only after reading the local shortcode implementation.
…
常见问题
什么是 Hugo?
Hugo 是一个速度非常快的静态站点生成器,常用于搭建网站和博客。
什么是 Markdown?
Markdown 是一种简单的标记语言,让你可以用常见的符号来设置文本格式。它被广泛用于编写网络内容。
为什么不用通用的转换工具?
通用转换工具可能无法理解你 Hugo 网站的特定定制(比如自定义短代码)。这个工具会按照你自己网站的规则进行转换,结果更加忠实于原文。
详情
作者的原始描述
Convert Hugo documentation sites and Hugo-managed content into standard Markdown.
热度
- GitHub 星标
- 48k
- 排名
- #4852
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。