Migrate from Hugo
accent import hugo reads a Hugo site and writes a new Accent site beside it. It never writes into the Hugo site. The new site builds at once: each Hugo shortcode becomes a component stub that you, or a coding agent, convert later.
Run the import
# Show what the import changes. Nothing is written.
accent import hugo ./my-hugo-site
# Write the new site to ./my-hugo-site-accent
accent import hugo ./my-hugo-site --write
# One language, to another directory
accent import hugo ./my-hugo-site --language en --output ./accent-site --write
| Flag | Description |
|---|---|
--output <DIR> | The new site. Default: <source>-accent beside the source. It must not be inside the source |
--language <CODE> | Import only this language. Repeatable. Default: every configured language |
--reference-output <DIR> | Hugo’s built site (public/), so the report names a Hugo page to compare each stub with |
--mapping <FILE> | The mapping file. Default: accent-import.yaml in the source, when it exists |
--write | Write the new site. Without it, the command prints the report only |
Then go to the new site, and run accent validate and accent serve.
What the import changes
| Hugo | Accent |
|---|---|
_index.md | index.md |
A directory such as blog/_posts/ | blog/posts/, because Accent reads a directory whose name starts with _ as a page module. A headless bundle keeps its name |
content/<lang>/x.md | x.<lang>.md |
+++ TOML frontmatter | YAML frontmatter, with the comments kept |
_build: {render: never} | render: false, a data page |
draft: true | status: draft |
A relative entry in aliases | The absolute URL, which Accent redirects |
A page under a :slug pattern with no slug | slug from the title, as Hugo derives it |
| A key written twice | The last value, as Hugo reads it |
{{< x a="1" >}}...{{< /x >}} | {% x a="1" %}...{% /x %} |
{{< x "word" >}} | {% x arg0="word" /%}, or the name that the mapping file gives |
{{< ref "x.md" >}} | The URL of the page, resolved once |
{{< mermaid >}} | {% diagram type="mermaid" %} |
{{</* x */>}} | The literal text {{< x >}} |
[permalinks] | content.permalinks |
/x/ URLs (uglyURLs off) | site.trailing_slash: always, and links to known pages in the slash form |
static/ | static/. Each exact Netlify rule in _redirects that names a page becomes an alias of that page |
A shortcode in fenced code stays as written. A shortcode whose name Accent already uses, such as include or tabs, becomes hugo-<name>. Hugo .html content pages are listed in the report, and you write them as markdown.
The mapping file
accent-import.yaml names the positional arguments of a shortcode, or maps a shortcode to a tag that Accent already has:
shortcodes:
heading:
positional: [text] # {{< heading "x" >}} becomes {% heading text="x" /%}
alert:
tag: callout # write the theme's callout tag; no stub is written
Convert the stubs
The import writes the theme themes/hugo-import. Each shortcode is a component stub there:
- The manifest,
shortcodes/<tag>.yaml, holdsstub: trueand the attributes that the content uses. - The template,
shortcodes/<tag>.html.jinja, shows a visibleaccent-import-stubelement. A comment at its top holds the Hugo template.
accent validate lists each stub that is left. When no stub is listed, the conversion is done.
The import/ directory of the new site holds three files:
STUBS.mdlists the stubs, the most used first.report.jsonlists each stub with its attributes, its uses, three example pages, and the Hugo template. A program or an agent reads it.SKILL.mdis an Agent Skill that tells a coding agent how to convert one stub. Copy or link it into the skills directory of your agent, then ask the agent to convert the stubs one at a time.