Skip to content

autogeoflow/blog-template

Repository files navigation

GEOFlow Blog Template

中文说明

This is a standalone Next.js blog template for publishing GEOFlow blog content. It reads blog settings, categories, authors, and articles from the GEOFlow Blog API, then renders a public blog site with article lists, article detail pages, category pages, archives, search, multilingual routes, SEO metadata, and sitemap output.

Features

  • GEOFlow Blog API integration for settings, catalog data, article lists, and article detail pages.
  • Home page with site profile, search, article list, featured articles, hot articles, categories, and optional carousel slides.
  • Article detail pages with markdown rendering, cover images, author info, tags, related articles, article ads, and structured data.
  • Category pages with paginated article lists and category navigation.
  • Archive pages grouped by publish month, including paginated month archives.
  • Multilingual blog routes for English, Chinese, and Japanese by default.
  • Language switcher that links translated articles when the API provides source_title_id relationships.
  • Light and dark theme toggle stored in the browser.
  • Preview mode when server API credentials are not configured. You can enter API config in the browser and preview without changing .env.
  • SEO support for metadata, Open Graph images, robots.txt, sitemap.xml, and JSON-LD.

Requirements

  • Node.js 20 or newer.
  • pnpm 10.
  • A GEOFlow API token with blog read permission.

Quick Start

Install dependencies:

pnpm install

Create a local environment file:

cp .env.example .env.local

Edit .env.local:

GEOFLOW_API_BASE_URL=https://autogeoflow.com
GEOFLOW_API_TOKEN=gf_xxx
NEXT_PUBLIC_SITE_URL=https://example.com
GEOFLOW_BLOG_LANGUAGE_CODE=["en","zh","ja"]
GEOFLOW_BLOG_DEFAULT_LANGUAGE_CODE=en

Start the development server:

pnpm dev

Open http://localhost:3000.

Environment Variables

Variable Required Description
GEOFLOW_API_BASE_URL Yes for production GEOFlow API base URL. Example: https://autogeoflow.com.
GEOFLOW_API_TOKEN Yes for production Blog read token used by server-side API requests.
NEXT_PUBLIC_SITE_URL Recommended Public site URL used for canonical URLs, sitemap URLs, and absolute links.
GEOFLOW_BLOG_LANGUAGE_CODE Optional Supported languages. Accepts a JSON array or comma-separated list. Default: ["en","zh","ja"].
GEOFLOW_BLOG_DEFAULT_LANGUAGE_CODE Optional Default blog language. Default: first configured language.

If GEOFLOW_API_BASE_URL or GEOFLOW_API_TOKEN is missing, the app shows preview mode. Preview mode stores the API base URL and token in localStorage for the current browser only.

Routes

Route Purpose
/ Home page, search, latest articles, featured articles, hot articles, and categories.
/article/[slug] Article detail page.
/category/[slug] Category article list.
/archive Archive index grouped by year and month.
/archive/[year]/[month] Monthly archive with pagination.
/sitemap.xml Dynamic sitemap generated from articles, categories, archives, and languages.
/robots.txt Robots rules and sitemap location.

Non-default language pages use the language prefix, for example /zh, /zh/article/example-slug, or /ja/archive.

Project Structure

app/                 Next.js routes, metadata, sitemap, and robots output
components/          Blog UI components
lib/                 GEOFlow API client, language helpers, metadata helpers, and format utilities
public/              Static assets if you add any
.env.example         Example runtime configuration

Common Commands

pnpm dev      # Start local development
pnpm build    # Build for production
pnpm start    # Start the production build
pnpm lint     # Run ESLint

Deployment Notes

  1. Configure all production environment variables on your hosting platform.
  2. Set NEXT_PUBLIC_SITE_URL to the final public domain.
  3. Use a GEOFlow token with only the permissions needed for blog reading.
  4. Run pnpm build before deployment to catch configuration or TypeScript issues.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors