String Utilities 工具已更新 3 天前

Markdown Metadata Generator

Markdown Metadata Generator turns a JSON object into YAML front matter wrapped in --- lines, ready to paste at the top of a Markdown file for Jekyll, Hugo, Eleventy and similar tools. Your JSON is checked in the browser, then converted on the server by the Symfony YAML component. Copy the block or download it as markdown-front-matter.md.

永久免费 易于使用 立竿见影的效果 私密且安全

使用 Markdown Metadata Generator

Markdown 元数据生成器

将 JSON 对象转换为适用于 Markdown 文档的规范 YAML 前置信息。

JSON 对象输入

请粘贴一个有效的 JSON 对象以进行转换
输入必须是一个 JSON 对象。它将作为 发送至data API。
等待 JSON
输入状态
0 行
生成的输出

输出前言

生成的 YAML 前置信息
元数据提示
使用此工具为博客文章、文档页面、静态网站文件、变更日志以及基于 Markdown 的 CMS 内容创建前置信息。

阅读内容

了解该工具的工作原理以及何时使用它。

Turn a JSON object into YAML front matter

Markdown Metadata Generator builds the metadata block that sits at the very top of a Markdown file. You give it a JSON object, for example the fields your blog post or documentation page needs, and it returns the same data written as YAML between two --- lines. That block is called front matter, and it is how static site generators and Markdown-based content systems learn a page's title, date, tags, author, layout and any other field you define.

Writing front matter by hand is easy to get slightly wrong. YAML cares about indentation, colons inside values can break parsing, and a date or a word like yes may be read as a different type than you meant. Starting from JSON, which most developers already produce from scripts, APIs or a CMS export, and letting a real YAML library do the formatting removes most of those small mistakes.

Where front matter is used

Front matter is read by tools such as Jekyll, Hugo, Eleventy, Astro, Docusaurus, Gatsby and many headless or flat-file CMS platforms. Typical uses include:

  • Blog posts: title, date, author, tags, draft.
  • Documentation pages: sidebar_position, slug, description.
  • Changelogs and release notes: version, released, breaking.
  • Note-taking vaults: aliases, created, status.

The tool does not know which generator you use and does not add any fields of its own. It writes exactly the keys you supply, in the order you supply them.

What happens when you click Generate

This is the one tool in the Markdown family that relies on the server for its main job. Your browser first checks the input locally: it must be valid JSON and it must be an object (curly braces), not an array, a string or a number. The Input status card shows "Waiting for JSON", "Invalid JSON", "JSON must be an object" or "Valid JSON object", and the footer counts the top-level keys.

When the input is valid, the object is sent to the site's API as the data field. On the server, the Symfony YAML component converts it, and the result is wrapped in --- lines and returned to the page. The endpoint returns the YAML and does not save your data; it is rate-limited like the site's other tool endpoints. If you are working with confidential values, remember that they do leave your device for this step.

How values are written

The formatting follows fixed settings in the code, which explains most of what you will see in the output:

JSON inputYAML outputWhy
"title": "Hello: World"title: 'Hello: World'A colon followed by a space would break YAML, so the value is quoted.
"date": "2024-05-01"date: '2024-05-01'A string that looks like a date is quoted so it stays a string.
"draft": falsedraft: falseBooleans and numbers keep their type.
"tags": ["a", "b"]a block list with - a and - bLists are written one item per line.
"summary": "line1\nline2"summary: |- followed by indented linesMulti-line strings use a literal block.
"empty": []empty: {}An empty list becomes an empty mapping (see limitations).

Indentation is two spaces per level. Nesting is written in block style for the first four levels; anything deeper is written inline in flow style, such as b: { c: 1 }. Some keys that YAML 1.1 parsers treat as special words, such as n or y, are quoted.

Step-by-step

  1. Prepare a JSON object. Example: {"title": "Launch notes", "date": "2026-03-02", "tags": ["release", "product"], "draft": false}.
  2. Paste it into the Input JSON Object editor, or click Paste JSON to read it from your clipboard.
  3. Look at the Input status card. Fix any syntax error until it says "Valid JSON object".
  4. Click Generate. The button shows "Working" while the request is in flight.
  5. The YAML appears in Output Front Matter, and the Generated output card shows the line count.
  6. Click Copy Front Matter and paste it at the very top of your Markdown file, or click Download to save it as markdown-front-matter.md.
  7. Copy Input copies your JSON back out; Clear empties both editors.

Example output

For the JSON above, the generated block is:

---
title: 'Launch notes'
date: '2026-03-02'
tags:
- release
- product
draft: false
---

The YAML library is cautious with strings: a title containing a space is single-quoted, and the date is quoted because it looks like a date. Single words such as release are left bare. Both forms are valid YAML and read the same way.

Good habits

  • Use the field names your generator expects. Hugo, Jekyll and Docusaurus each document their own keys. The tool will not rename date to pubDate for you.
  • Decide how you want dates typed. Because date-like strings are quoted, your site will receive a string. Most generators parse it fine, but if you need a native timestamp, remove the quotes after pasting.
  • Put the block first. Front matter only works when --- is the first line of the file, with nothing before it, not even a blank line.
  • Generate from scripts. If you export posts from a database or spreadsheet, produce one JSON object per post and run each through the tool to check how it will look.

Things to avoid

  • Do not paste a JSON array of several posts. The input must be a single object; arrays are rejected before anything is sent.
  • Do not paste existing YAML or Markdown. The input is parsed as JSON only.
  • Do not send an empty object {}. The API requires at least some data and responds with an error.
  • Do not include passwords, API keys or private customer data. The object is processed on the server.

Limitations

  • Empty arrays become empty mappings. JSON [] is decoded on the server as an empty PHP array, which cannot be told apart from an empty object, so it is written as {}. Change it to [] by hand if your generator expects a list.
  • Deep nesting is inlined. Levels beyond the fourth are written in compact flow style. It is valid YAML, just less readable.
  • No comments. JSON has no comments, so the output has none either.
  • No validation against a schema. The tool checks JSON syntax, not whether your fields make sense to your site.
  • Needs a connection. Because generation uses the API, it will fail if you are offline; a toast shows the error message.

Related tools

Once the front matter is in place you can check how the body renders with Markdown Previewer, which hides the front matter block and shows only the content, or tidy blank lines in the body with Markdown Remove Empty Lines.

Frequently Asked Questions

常见问题解答

针对用户在信任结果之前常提出的疑问,提供简短解答。

A single valid JSON object. Arrays, plain strings, numbers and YAML are rejected, and the Input status card tells you which problem it found.

The JSON is validated in your browser, then sent to the site's API, where the Symfony YAML component converts it. The endpoint returns the YAML and does not save it.

Strings that look like dates are quoted so YAML keeps them as text. Remove the quotes after pasting if your site needs a native date value.

The server decodes JSON into PHP arrays, and an empty list cannot be told apart from an empty object, so it is written as an empty mapping. Edit it to [] if required.

Yes. The output always starts and ends with a --- line, so it is ready to paste at the top of a Markdown file.

It is standard YAML front matter, the format read by Jekyll, Hugo, Eleventy, Astro, Docusaurus and similar tools. You still need to use the field names your generator expects.

The front matter is saved as markdown-front-matter.md.

评论 (0)

用于用户讨论、边界情况及后续建议。
发表评论
您的评论提交后将公开展示。
目前尚无评论。快来发表第一条评论吧!
请告诉我们!
报告此工具的问题

请描述您遇到的问题,以便我们进行调查并改进该工具。

什么最有帮助
请提供输入内容、预期结果、实际结果、浏览器/设备信息,如有帮助,请附上截图。
“截图”按钮会截取浏览器中的页面,并将生成的图片作为附件添加到此表单中。
整页截图
通过 newisty 在您的浏览器中捕获。
尚未截取屏幕截图。
工具 报告