跳转到内容

Hosting & Deployment Guide

此内容尚不支持你的语言。

Since Hugo generates a static website (HTML/CSS/JS), you can host it anywhere for free! We recommend Netlify for the best balance of features and ease of use.

Best for: Most users, especially those needing CMS support, forms, or headers.

  1. Push to GitHub Ensure your site code is pushed to a GitHub repository.

  2. Import to Netlify

    • Log in to Netlify.
    • Click Add new site > Import an existing project.
    • Select GitHub and authorize.
    • Choose your repository.
  3. Configure Build Netlify usually detects Hugo automatically, but verify these settings:

    • Build Command: hugo --gc --minify
    • Publish Directory: public
  4. Deploy Click Deploy site. Netlify will build your site and give you a live URL (e.g., vibrant-name-123.netlify.app).

Best for: Simple sites kept entirely within the GitHub ecosystem.

  1. Configure Workflow Create .github/workflows/publish.yaml in your repo: View Workflow File

  2. Enable Pages

    • Go to repo Settings > Pages.
    • Under Source, select GitHub Actions.
  3. Trigger Build

    • Go to the Actions tab.
    • Select Deploy Website on the left.
    • Click Run workflow.

Enable GitHub Pages Source

Best for: High traffic sites requiring edge performance.

  1. Connect Git

    • Log in to the Cloudflare Dashboard.
    • Go to Workers & Pages > Create application > Pages > Connect to Git.
  2. Configure Build

    • Production branch: main
    • Build command: pnpm install && hugo --gc --minify && pnpm dlx pagefind --source "public"
    • Build directory: public

Best for: Next.js users or those who prefer Vercel’s ecosystem.

  1. Import Project Import your GitHub repo on the Vercel Dashboard.

  2. Configure Settings

    • Framework Preset: Hugo
    • Build Command: hugo --gc --minify && pnpm dlx pagefind --source "public"
    • Environment Variable: Add HUGO_VERSION (e.g., 0.149.0) matching your hugoblox.yaml.