mirror of
https://github.com/imfing/hextra.git
synced 2025-08-23 19:56:38 -04:00

* docs(blog): prepare for v0.10 release post * Update v0.10.md * Update v0.10.md to refine upgrade instructions and enhance blog features. Added synchronized tab switching and pagination controls, while improving the search experience and table of contents navigation. * Enhance v0.10 release documentation with detailed upgrade instructions and migration guide. Added Tailwind theme variable customization section and clarified breaking changes. Improved clarity on CSS class prefix changes for better user experience. * Update v0.10.md to enhance upgrade instructions, clarify breaking changes, and improve overall readability. Adjusted formatting for consistency and added details on asset management and user experience improvements. * Add notable new features to v0.10.md, including dropdown menu support, enhanced search experience, and blog list pagination. Updated FlexSearch upgrade details for clarity and improved migration guide by removing redundant breaking change notes. * chore: update zh-cn translation * chore: update ja translation * chore: update fa and ja translations * chore: prepare release
5.9 KiB
5.9 KiB
title, prev, next
title | prev | next |
---|---|---|
サイトのデプロイ | /docs/guide/shortcodes | /docs/advanced |
Hugo は静的サイトを生成するため、柔軟なホスティングオプションが利用可能です。 このページでは、Hextra サイトを様々なプラットフォームにデプロイする方法を解説します。
GitHub Pages
GitHub Pages は無料でサイトをデプロイ・ホストするための推奨方法です。
hextra-starter-template を使用してサイトを構築した場合、GitHub Pages への自動デプロイを支援する GitHub Actions ワークフローが最初から用意されています。
{{% details title="GitHub Actions 設定" closed="true" %}}
以下は hextra-starter-template の設定例です:
# Hugo サイトをビルドし GitHub Pages にデプロイするサンプルワークフロー
name: Deploy Hugo site to Pages
on:
# デフォルトブランチへのプッシュ時に実行
push:
branches: ["main"]
# Actions タブから手動で実行可能
workflow_dispatch:
# GITHUB_TOKEN の権限を設定(GitHub Pages へのデプロイを許可)
permissions:
contents: read
pages: write
id-token: write
# 同時実行を1つに制限(進行中の実行はキャンセルしない)
concurrency:
group: "pages"
cancel-in-progress: false
# デフォルトシェルを bash に設定
defaults:
run:
shell: bash
jobs:
# ビルドジョブ
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.147.7
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # .GitInfo と .Lastmod 用に全履歴を取得
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Setup Hugo
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Build with Hugo
env:
# Hugo モジュールとの最大互換性のため
HUGO_ENVIRONMENT: production
HUGO_ENV: production
run: |
hugo \
--gc --minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
# デプロイジョブ
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
{{% /details %}}
{{< callout >}}
リポジトリ設定で、Pages > Build and deployment > Source を GitHub Actions に設定してください:
{{< /callout >}}
デフォルトでは、上記の GitHub Actions ワークフロー .github/workflows/pages.yaml
は https://<USERNAME>.github.io/<REPO>/
へのデプロイを想定しています。
https://<USERNAME>.github.io/
にデプロイする場合は --baseURL
を修正してください:
54
55
56
57
run: |
hugo \
--gc --minify \
--baseURL "https://${{ github.repository_owner }}.github.io/"
独自ドメインを使用する場合は、--baseURL
の値を適宜変更してください。
Cloudflare Pages
- サイトのソースコードを Git リポジトリ(GitHub など)に配置
- Cloudflare ダッシュボード にログインしアカウントを選択
- Account Home で Workers & Pages > Create application > Pages > Connect to Git を選択
- リポジトリを選択し、Set up builds and deployments セクションで以下を設定:
設定項目 | 値 |
---|---|
Production branch | main |
Build command | hugo --gc --minify |
Build directory | public |
詳細は以下を参照:
Netlify
- コードを Git リポジトリ(GitHub, GitLab など)にプッシュ
- Netlify に プロジェクトをインポート
- [hextra-starter-template][hextra-starter-template] を使用していない場合、以下を手動設定:
- Build command を
hugo --gc --minify
に設定 - Publish directory を
public
に指定 - 環境変数
HUGO_VERSION
を追加し0.147.7
を設定、またはnetlify.toml
ファイルで設定
- Build command を
- デプロイ!
詳細は Hugo on Netlify を参照
Vercel
- コードを Git リポジトリ(GitHub, GitLab など)にプッシュ
- Vercel ダッシュボード に移動し Hugo プロジェクトをインポート
- プロジェクトを設定、Framework Preset で Hugo を選択
- Build Command と Install command を上書き:
- Build Command を
hugo --gc --minify
に設定 - Install Command を
yum install golang
に設定
- Build Command を