0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Docusaurus でブログサイトを作成する

Last updated at Posted at 2022-07-16

ブログの作成手法を色々調べた結果(WordPress Hexo 等)、Docusaurusが最も簡単にそれなりのサイトが作成できそうだという結論に至りました。(当方所感)

Docusaurus とは

  • facebook が開発のベースとなってます。
  • コンテンツをMarkdownで記載すればWebサイトの体裁が出来上がります。
  • Docusaurusのサイト自体がDocusaurusで出来ているので、このサイトを見るのが手っ取り早いです。
    つまりこのサイトと同じような構成で独自のWebサイトが作成できます。

この記事の目的

  • Docusaurus をインストールします。
  • 最低限のカスタマイズを実施します。
  • ローカルでWebサイトを起動し、動作を確認します。

導入手順

Node.js インストール

Nodeダウンロードサイト
image
image

Docusaurus プロジェクトの作成

npx create-docusaurus@latest my-website classic

サイト起動

cd my-website
npm run start

http://localhost:3000/ で起動イメージが確認できます。
image
image

Docs-only mode へ切り替え

docusaurus.config.js
module.exports = {
  // ...
  presets: [
    '@docusaurus/preset-classic',
    {
      docs: {
        routeBasePath: '/', // Serve the docs at the site's root
        /* other docs plugin options */
      },
      blog: false, // Optional: disable the blog plugin
      // ...
    },
  ],
};
  • docs/intro.mdを以下のとおり編集します。
docs/intro.md
---
slug: /
---

This page will be the home page when users visit https://example.com/.
  • /src/pages/index.jsを削除します。
    ※ サイトの初期ページをdocsサイトにするためindex.jsの削除が必要です。

  • 設定後イメージ
    image

コンテンツの追加

  • コンテンツの追加はMarkdownファイルを追加するだけです。

/docs/サンプル/サンプル.md  
image

👇GitHubはこちら

👇参考URL

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?