← 返回 Skills 市场
tanteng

Hugo Blog Publisher

作者 Tony · GitHub ↗ · v1.1.1 · MIT-0
cross-platform ⚠ suspicious
997
总下载
0
收藏
2
当前安装
8
版本数
在 OpenClaw 中安装
/install hugo-blog-publisher
功能描述
发布文章到 Hugo 博客。用于当用户说"发布博客"、"推送到blog"、"post to blog"、"发布文章"等。自动完成 front matter 渲染、<!--more--> 标记添加、git 推送流程。
使用说明 (SKILL.md)

Hugo Blog Publisher

将 Markdown 文章发布到 Hugo 博客并推送到 GitHub。

自动读取配置

此 Skill 会自动尝试从以下位置读取博客配置:

  1. 用户记忆文件(MEMORY.md / USER.md)中的博客域名、路径等
  2. 博客目录下的 .git 配置

如果未找到配置,才询问用户。

使用前提

  1. 本地运行:此 Skill 需要在能够访问博客目录的机器上运行
  2. Git 配置:确保机器上有 Git 和 GitHub 访问权限

发布流程

1. 分析内容

从用户提供的文章内容中自动提取:

  • 标题:从 front matter 或内容中提取
  • 标签:根据内容主题自动判断(如 AI → ["ai"])
  • 分类:根据内容类型判断(如技术文章 → ["tech"])

2. 生成文件名

  • 格式: content/posts/{slug}.md
  • slug: 标题转为 URL 友好格式(小写、连字符、去除特殊字符)
  • 注意:文件名不要包含日期,日期在 front matter 的 date 字段中指定

3. 渲染 Front Matter

---
title: "文章标题"
date: YYYY-MM-DD
draft: false
tags: ["tag1", "tag2"]
categories: ["Category"]
description: "文章描述"
---

重要规则

  • categories:使用已有分类(小写英文 slug),如 tech, investment, ai, photo
  • tags:使用小写英文 slug,不要用中文
  • slug:文件名使用小写英文,不要用中文

4. 标签/分类映射(重要)

文章 frontmatter 用英文 slug,页面展示用中文,通过 Hugo Taxonomy Branch Bundle 实现:

  1. frontmatter 中使用英文 slug:

    tags: ["ssg", "ssr"]
    categories: ["tech"]
    
  2. 如果遇到新标签/分类没有映射文件,需要创建:

    content/tags/\x3Cslug>/_index.md
    content/categories/\x3Cslug>/_index.md
    
  3. 文件内容极简:

    ---
    title: "显示的中文名"
    ---
    

不用 i18n,全部用 _index.md 映射!

常用分类 (categories)

Slug 中文显示
tech 技术
photo 摄影
ai AI
investment 投资
tech-news 科技资讯
science 科学
art 艺术
life 生活
reading-notes 读书笔记

常用标签 (tags)

Slug 中文显示
ai AI
llm 大语言模型
agent 智能体
programming 编程
thinking 思考
photography 摄影
camera 相机
photo 照片
options 期权
trading 交易
investment 投资
stock 股票
php PHP
go Go
kubernetes Kubernetes
rag RAG

专属名词(保持英文显示)

  • AI、RAG、NLP、Kubernetes、Go、Elasticsearch、PHP、SQL、Kimi、DeepSeek、Claude、GPT、SSG、SSR 等技术名称用英文 slug

5. 添加 \x3C!--more--> 截断标记

在第一段或导言后添加 \x3C!--more-->,让列表页显示摘要。

位置通常在:

  • 第一段结束后的空行
  • 导言和正文之间

6. Git 推送

从博客目录自动检测 git 状态并推送:

cd {博客路径}
git add content/posts/{文件名}
git commit -m "新增:{文章标题}"
git push

如果 git push 需要认证,确保用户已配置 SSH key 或 git credentials。

7. 返回部署链接

告知用户文章已发布成功。

注意:不要硬编码域名,应该根据用户提供的博客信息返回相应链接。

使用示例

用户:帮我发布这篇blog(附文章内容)

系统自动完成:
1. 分析内容,提取标题、标签、分类
2. 生成文件名(slug)
3. 添加 front matter 和 \x3C!--more--> 标记
4. 如需新标签/分类,创建 _index.md 映射文件
5. 检测博客目录并推送
6. 返回部署链接

注意事项

  • slug 生成:英文直接用,中文可用拼音或英文关键词
  • \x3C!--more--> 位置:根据文章结构选择合适位置
  • commit message:建议用 "新增:" 前缀
  • 如果用户没有提供博客路径,默认用当前目录的 blog 子目录
  • 所有标签/分类映射都用 _index.md 文件方式,不用 i18n/zh.toml!
安全使用建议
Before installing or invoking this skill, consider the following: - It will access local files to find blog configuration (MEMORY.md / USER.md and the repository's .git). Make sure those files don't contain secrets or unintended content you don't want read. - The skill will run git add/commit/git push in the detected blog directory. Confirm the repository remote and branch to avoid pushing to the wrong remote or exposing drafts. Provide the blog path explicitly if you don't want the skill to auto-detect. - Ensure your machine's git/SSH credentials are configured correctly; the skill will use whatever credentials are already present. If you use credential helpers or tokens stored in files, be aware those mechanisms will be invoked by git. - Because this is instruction-only, the agent will perform filesystem and git operations when invoked. Run it in a safe environment (a local clone or disposable branch) the first time to verify behavior. - If you are uncomfortable with automatic discovery of MEMORY.md/USER.md or automatic pushes, ask the agent to show the planned changes and the exact git commands before executing them, or provide explicit configuration (blog path, remote) instead of allowing auto-detection.
功能分析
Type: OpenClaw Skill Name: hugo-blog-publisher Version: 1.1.1 The skill bundle automates Hugo blog publishing but introduces potential shell injection vulnerabilities in SKILL.md. It instructs the AI agent to execute shell commands (git add/commit/push) using un-sanitized variables such as {博客路径}, {文件名}, and {文章标题} derived from user-provided content or memory files. While the functionality is aligned with the stated purpose, the construction of shell strings from untrusted input without explicit sanitization instructions is a high-risk pattern.
能力评估
Purpose & Capability
Name/description (publish to Hugo, render front matter, add <!--more-->, git push) align with the SKILL.md instructions. The skill does not request unrelated credentials, binaries, or installs. Reading local blog config and performing git operations is coherent with publishing workflow.
Instruction Scope
Instructions explicitly tell the agent to locate blog configuration (including MEMORY.md/USER.md and .git), generate front matter, create tag/category _index.md files if needed, add <!--more-->, and run git add/commit/push in the blog directory. This is expected for a publisher but worth noting: automatic reading of MEMORY.md/USER.md and .git config can surface sensitive local information (paths, remote URLs, occasionally embedded credentials). The skill will run git push which will transmit data to whatever remote is configured.
Install Mechanism
No install spec and no code files — instruction-only. This minimizes disk writes and supply-chain risk.
Credentials
The skill declares no required environment variables or credentials. It relies on the host machine's existing git/SSH/GitHub configuration, which is proportionate to a local publishing tool. No unrelated credentials are requested.
Persistence & Privilege
always is false and the skill is user-invocable. The skill does not request persistent system-wide changes or modify other skills' configuration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install hugo-blog-publisher
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /hugo-blog-publisher 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.1.1
修正标签分类映射方式,全部使用_index.md文件
v1.0.1
文件名格式改为不含日期
v1.5.0
- 自动读取博客配置:现在会优先从用户记忆文件和 .git 配置中获取博客域名和路径,无需每次手动输入 - 仅在找不到配置时才询问用户 - 其他使用流程和注意事项未变
v1.4.0
- 新增自动分析功能,能够从文章内容自动提取标题、标签和分类,无需用户手动输入。 - 发布示例简化,为自动完成所有分析和推送步骤。 - 原版需手动输入标题、标签等信息,现自动判断更智能。 - 其他发布和推送流程保持不变,使用体验更便捷。
v1.3.0
- Clarified git 推送说明,强调自动检测 git 状态并推送,并补充认证要求说明。 - 优化了使用示例和交互步骤描述,使流程更简明易懂。 - 补充系统自动处理事项列表。 - 微调部分用词和结构,使文档更清晰、易用。 - 内容无技术实现变动,仅文档优化和完善说明。
v1.2.0
- Deployment link instructions updated: now advises not to hardcode the domain and to return a link based on user-supplied blog info. - Clarified deployment link step to only notify that the article has been published successfully. - No functional changes; SKILL.md documentation improvement only.
v1.1.0
Version 1.1.0 – Added metadata and improved usage clarity - Added _meta.json file for enhanced package metadata. - Rewrote SKILL.md for clearer publishing instructions, required inputs, and improved usage guidance. - Clarified default behaviors for blog path, Git remote, tags, categories, and slug generation. - Included more usage examples and expanded best practices. - Emphasized prerequisites and step-by-step publishing flow.
v1.0.0
Initial release of hugo-blog-publisher. - Publish Markdown articles to a Hugo blog and push to GitHub. - Automatically renders front matter, adds <!--more--> markers, and handles git workflow. - Supports custom tags and categories based on article type. - Notifies user with the Vercel deployment link after publishing. - Triggered by phrases like "发布博客", "推送到blog", or "post to blog".
元数据
Slug hugo-blog-publisher
版本 1.1.1
许可证 MIT-0
累计安装 2
当前安装数 2
历史版本数 8
常见问题

Hugo Blog Publisher 是什么?

发布文章到 Hugo 博客。用于当用户说"发布博客"、"推送到blog"、"post to blog"、"发布文章"等。自动完成 front matter 渲染、<!--more--> 标记添加、git 推送流程。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 997 次。

如何安装 Hugo Blog Publisher?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install hugo-blog-publisher」即可一键安装,无需额外配置。

Hugo Blog Publisher 是免费的吗?

是的,Hugo Blog Publisher 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Hugo Blog Publisher 支持哪些平台?

Hugo Blog Publisher 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Hugo Blog Publisher?

由 Tony(@tanteng)开发并维护,当前版本 v1.1.1。

💬 留言讨论