Skip to content

isirmt/NextjsBlogWithGitPAT

Repository files navigation

nextjs_blog_with_git_pat

Next.js TypeScript Tailwind CSS GitHub API pnpm

日本語版README

Overview

This project dynamically builds pages as a blog by retrieving .md files from a specified folder in another repository.

Development under the Development Environment

First, install the necessary packages.

pnpm i

Next, run the development environment.

pnpm dev

Environment Variables

Set the following environment variables in your local environment (.env.local).

  • GIT_USERNAME: Target username
  • GIT_REPO: Target repository name
  • GIT_POSTS_DIR: Folder in the target repository where the MD files are located
  • GIT_IMAGES_DIR: Image folder in the target repository
  • GIT_PROFILE_PATH: Path to the profile MD file in the target repository
  • GIT_TOKEN: GitHub API (PAT) token
  • NEXT_PUBLIC_RECAPTCHA_SITE_KEY: reCAPTCHA site key
  • RECAPTCHA_SECRET_KEY: reCAPTCHA secret key
  • GTM_ID: Google Tag Manager

You can also change the public URL in .env.production.

Example of a Blog Repository


isirmt/example_blog_posts

├── posts/
│   ├── [Series Name]/
│   │   ├── (meta.json)
│   │   ├── 1.md
│   │   ├── 2.md
│   │   └── ...
│   └── ArticleName.md
├── img/
│   ├── [Optional]
│   └── Optional
└── profile/
    └── index.md

In this case, set the environment variables as follows:

  • GIT_USERNAME=isirmt
  • GIT_REPO=example_blog_posts
  • GIT_POSTS_DIR=posts
  • GIT_IMAGES_DIR=img
  • GIT_PROFILE_PATH=profile/index.md

Also, modify /src/static/constant.ts as needed.

Build

Execute the following commands:

pnpm build
pnpm start

About

Markdown blog using Next.js and GitHub API

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •