تخطَّ إلى المحتوى

Migrating from Hugo

هذا المحتوى غير متوفر بلغتك بعد.

Hugo is an open-source static site generator built on Go.

Key Similarities between Hugo and Astro

Section titled Key Similarities between Hugo and Astro

Hugo and Astro share some similarities that will help you migrate your project:

  • Hugo and Astro are both modern static-site generators, ideally suited to content-driven websites like blogs.

  • Hugo and Astro both allow you to author your content in Markdown. However, Hugo includes several special frontmatter properties and allows you to write frontmatter in YAML, TOML or JSON. Even though many of your existing Hugo frontmatter properties will not be “special” in Astro, you can continue to use your existing Markdown files and YAML frontmatter values.

  • Hugo and Astro both allow you to enhance your site with a variety of integrations and external packages.

Key Differences between Hugo and Astro

Section titled Key Differences between Hugo and Astro

When you rebuild your Hugo site in Astro, you will notice some important differences:

To convert a Hugo blog to Astro, start with our blog theme starter template, or explore more community blog themes in our theme showcase.

You can pass a --template argument to the create astro command to start a new Astro project with one of our official starters. Or, you can start a new project from any existing Astro repository on GitHub.

Terminal window
npm create astro@latest -- --template blog

Bring your existing Markdown (or MDX, with our optional integration) files as content to create Markdown or MDX pages. You may need to convert your frontmatter to YAML, since Astro only allows YAML frontmatter in these files.

To continue to use dynamic content such as variables, expressions or UI components within your Markdown content, add Astro’s optional MDX integration and convert your existing Markdown files to MDX pages. MDX supports YAML frontmatter, so you can keep your existing frontmatter properties. But, you must replace any shortcode syntax with MDX’s own syntax, which allows JSX expressions and/or component imports.

To convert other types of sites, such as a portfolio or documentation site, see more official starter templates on astro.new. You’ll find a link to each project’s GitHub repository, as well as one-click links to open a working project in StackBlitz, CodeSandbox and Gitpod online development environments.

المزيد من أدلة التحويل

ساهم

بماذا تفكّر؟

المجتمع
京ICP备15031610号-99