Docusaurus
Docusaurus ↗ は静的サイトジェネレーターです。これは、クライアントサイドのナビゲーションが高速なシングルページアプリケーションを構築し、Reactの全機能を活用してサイトをインタラクティブにします。すぐに使えるドキュメンテーション機能を提供しますが、個人のウェブサイト、製品サイト、ブログ、マーケティングランディングページなど、あらゆる種類のサイトを作成するために使用できます。
create-cloudflare ↗ CLI (C3) を使用してプロジェクトをセットアップします。C3は新しいプロジェクトディレクトリを作成し、Docusaurusの公式セットアップツールを開始し、即座にデプロイするオプションを提供します。
create-cloudflareを使用して新しいDocusaurusプロジェクトを作成するには、次のコマンドを実行します:
npm create cloudflare@latest -- my-docusaurus-app --framework=docusaurusyarn create cloudflare@latest my-docusaurus-app --framework=docusauruspnpm create cloudflare@latest my-docusaurus-app --framework=docusauruscreate-cloudflareは、Wrangler CLIや必要なアダプターを含む追加の依存関係をインストールし、セットアップに関する質問を行います。
All of the framework guides assume you already have a fundamental understanding of Git ↗. If you are new to Git, refer to this summarized Git handbook ↗ on how to set up Git on your local machine.
If you clone with SSH, you must generate SSH keys ↗ on each computer you use to push or pull from GitHub.
Refer to the GitHub documentation ↗ and Git documentation ↗ for more information.
Create a new GitHub repository by visiting repo.new ↗. After creating a new repository, go to your newly created project directory to prepare and push your local application to GitHub by running the following commands in your terminal:
git initgit remote add origin https://github.com/<your-gh-username>/<repository-name>git add .git commit -m "Initial commit"git branch -M maingit push -u origin mainIf you use create-cloudflare(C3) ↗ to create your new Docusaurus project, C3 will install all dependencies needed for your project and prompt you to deploy your project via the CLI. If you deploy, your site will be live and you will be provided with a deployment URL.
- Cloudflareダッシュボード ↗にログインし、アカウントを選択します。
- アカウントホームで、Workers & Pages > アプリケーションを作成 > Pages > Gitに接続を選択します。
- 作成した新しいGitHubリポジトリを選択し、ビルドとデプロイの設定セクションで、_Docusaurus_をフレームワークプリセットとして選択します。あなたの選択は次の情報を提供します。
| Configuration option | Value |
|---|---|
| Production branch | main |
| Build command | npm run build |
| Build directory | build |
サイトをデプロイした後、*.pages.dev上のプロジェクト用のユニークなサブドメインを受け取ります。
Docusaurusサイトに新しいコードをコミットし、その変更をGitHubにプッシュするたびに、Cloudflare Pagesは自動的にプロジェクトを再ビルドしてデプロイします。また、新しいプルリクエストでプレビューのデプロイにアクセスでき、変更が本番環境にデプロイされる前にサイトにどのように表示されるかをプレビューできます。
Cloudflare Pagesに最初のサイトをデプロイするための完全なガイドについては、はじめにガイドを参照してください。
By completing this guide, you have successfully deployed your Docusaurus site to Cloudflare Pages. To get started with other frameworks, refer to the list of Framework guides.