Show HN:基于 Git 的 Hugo 前端界面
Show HN: Git-based front-end interface for Hugo

原始链接: https://github.com/arashthr/hugo-flow

本项目为静态 Hugo 网站提供了一个自定义的 Web 前端界面,支持与 GitHub 无缝集成,可直接提交至存储库。主要功能包括动态存储库配置、双模式编辑器(所见即所得与原始 Markdown)以及自动 Base64 图像上传。 **部署与设置:** 开始之前,请在 `.env.local` 文件中配置 GitHub OAuth 凭据和 NextAuth 设置。 * **Node.js 部署:** 使用标准 npm 脚本构建项目,以获得优化的生产包。 * **Docker 部署:** 应用支持使用 Docker 和 Docker Compose 进行容器化部署,利用 Next.js 的独立输出(standalone output)实现极小的资源占用。 **生产环境步骤:** 1. 将 GitHub OAuth 回调 URL 更新为您的生产域名。 2. 生成安全的环境变量,包括唯一的 `NEXTAUTH_SECRET`。 3. 使用 `docker-compose up -d --build` 启动容器。 4. 使用 Caddy 反向代理处理 HTTPS 流量,将您的域名指向容器端口(3000)。 该方案为 Hugo 用户提供了专业且友好的 CMS 体验,在易用性与稳健、可扩展的部署选项之间实现了平衡。

抱歉。
相关文章

原文

A custom, web-based Front-end interface for your static Hugo website.

  • GitHub Integration: Commit files directly to your repository via the GitHub API.
  • Dynamic Configuration: Select your repository and paths dynamically via the UI.
  • Dual Editor Mode: Switch seamlessly between a WYSIWYG Rich Text editor and a raw Markdown editor.
  • Image Uploads: Upload images and have them automatically pushed as base64 blobs alongside your markdown post.
  1. Set up your .env.local file:
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_random_secret_here
GITHUB_ID=your_github_oauth_id
GITHUB_SECRET=your_github_oauth_secret
  1. Run the development server:

Production Deployment (Standard Node.js)

If you are not using Docker, you can run the application directly using Node.js:

  1. Ensure your .env.local is configured with your production keys and URL.
  2. Build the optimized production bundle:
  1. Start the production server:

The application will be running on http://localhost:3000.

Production Deployment (Docker + Caddy)

This application is ready to be deployed using Docker and Docker Compose. It leverages Next.js standalone output for a highly optimized, minimal container size.

1. Update GitHub OAuth App

Update your GitHub OAuth App's "Authorization callback URL" to your production domain: https://your-domain.com/api/auth/callback/github

2. Set Production Environment Variables

Create a .env file on your server in the same directory as docker-compose.yml:

NEXTAUTH_URL=https://your-domain.com
NEXTAUTH_SECRET=your_secure_random_string (generate via: openssl rand -base64 32)
GITHUB_ID=your_production_github_id
GITHUB_SECRET=your_production_github_secret

3. Run with Docker Compose

Start the application in the background:

docker-compose up -d --build

This will expose the app on port 3000 of your host machine.

4. Setup Caddy Reverse Proxy

If you are using Caddy to serve your domain, simply add this block to your Caddyfile:

your-domain.com {
    reverse_proxy localhost:3000
}

Reload Caddy (caddy reload), and your application will be securely available over HTTPS!

+++

联系我们 contact @ memedata.com