Skip to content

从鹈鹕迁移

是一个基于 Python 构建的开源静态站点生成器。

¥Pelican is an open-source static site generator built on Python.

Pelican 和 Astro 之间的主要相似之处

Section titled Pelican 和 Astro 之间的主要相似之处

¥Key Similarities between Pelican and Astro

Pelican 和 Astro 有一些相似之处,可以帮助你迁移项目:

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

  • Pelican 和 Astro 都是静态站点生成器,非常适合 内容驱动的网站 之类的博客。

  • Pelican 和 Astro 都内置了对 用 Markdown 写作 的支持,包括页面元数据的 frontmatter YAML 属性。然而,与 Pelican 相比,Astro 保留的 frontmatter 属性非常少。即使你现有的许多 Pelican frontmatter 属性在 Astro 中不会是 “special”,你也可以继续使用现有的 Markdown 文件和 frontmatter 值。

Pelican 和 Astro 之间的主要区别

Section titled Pelican 和 Astro 之间的主要区别

¥Key Differences between Pelican and Astro

当你在 Astro 中重建 Pelican 站点时,你会注意到一些重要的差异:

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

  • Pelican 支持以 Markdown 和重构文本 (.rst) 编写内容。Astro 支持 从 Markdown 和 MDX 创建页面 文件,但不支持重构文本。

  • Pelican 使用 HTML 文件和 Jinja 语法进行模板化。Astro 语法 是 HTML 的类似 JSX 的超集。所有有效的 HTML 都是有效的 .astro 语法。

  • Pelican 旨在构建内容丰富的网站(例如博客),并且具有一些内置的博客功能,你必须在 Astro 中自己构建这些功能。相反,Astro 提供了 官方博客主题 中包含的一些功能。

¥Switch from Pelican to Astro

要将 Pelican 文档站点转换为 Astro,请从我们的官方 星光文档主题入门模板 开始,或在我们的 主题展示 中探索更多社区主题。

¥To convert a Pelican documentation site to Astro, start with our official Starlight docs theme starter template, or explore more community themes in our theme showcase.

你可以将 --template 参数传递给 create astro 命令,以使用我们的官方启动器之一启动一个新的 Astro 项目。或者,你可以 从 GitHub 上任何现有的 Astro 存储库启动一个新项目

¥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 starlight

将你现有的 Markdown 内容文件带到 创建 Markdown 页面。你仍然可以通过将这些文档从 Pelican 的 content/ 文件夹复制到 Astro 中的 src/pages/ 来利用 基于文件的路由。你可能希望阅读有关 Astro 的项目结构 的内容以了解文件应位于何处。

¥Bring your existing Markdown content files to create Markdown pages. You can still take advantage of file-based routing by copying these documents from Pelican’s content/ folder into src/pages/ in Astro. You may wish to read about Astro’s project structure to learn where files should be located.

Pelican 可能已经为你处理了大部分网站布局和元数据。你可能希望阅读有关 将 Astro 布局构建为 Markdown 页面封装器 的内容,了解如何在 Astro 中自行管理模板,包括你的页面 <head>

¥Pelican may have handled much of your site layout and metadata for you. You may wish to read about building Astro Layouts as Markdown page wrappers to see how to manage templating yourself in Astro, including your page <head>.

与 Pelican 一样,Astro 有许多扩展其功能的插件。探索 官方集成列表 以添加 MDX 支持等功能,并在 Astro 集成目录 中找到数百个社区维护的集成。你甚至可以使用 Astro 集成 API 构建自己的自定义集成来扩展项目的功能。

¥Like Pelican, Astro has many plugins that extend its functionality. Explore the official list of integrations for adding features such as MDX support, and find hundreds more of community-maintained integrations in the Astro Integrations Directory. You can even use the Astro Integration API to build your own custom integration to extend your project’s features.

要转换其他类型的网站,例如作品集或博客,请参阅 astro.new 上的更多官方入门模板。你将找到每个项目的 GitHub 存储库的链接,以及用于在 StackBlitz、CodeSandbox 和 Gitpod 在线开发环境中打开工作项目的一键链接。

¥To convert other types of sites, such as a portfolio or a blog, 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.

¥Community Resources

  • 添加你自己的!

More migration guides

Astro 中文网 - 粤ICP备13048890号