Skip to content

Plumbiu/blog

Repository files navigation

Performance

Phone: phone-scores

PC: pc-scores

Features

Customize

Directory

File

Post

Front matter must have at least the following configuration to display post:

---
title: Title
date: Publish Date
desc: The article introduction, it can be a number, indicating that the introduction is the nth line of the article body (starting from 1)
---

Deploy to Github pages

Edit the RepoName in data/variable.ts file and BasePath in next.config.js file.

Warning

Github pages only support static resources, rewrites will not work, see next.config.js

However, you can create src/app/page.tsx src/app/list/page.tsx and src/app/list/[type]/page.tsx files to generate
// src/app/list/page.tsx
// src/app/page.tsx
import ArtlistAll from '@/list/[id]/[pagenum]/page'

export default function Art() {
  return (
    <ArtlistAll
      params={{
        type: 'blog',
        pagenum: '1',
      }}
    />
  )
}
// src/app/list/[id]/page.tsx
import ArtlistAll from './[pagenum]/page'
import { PostDir } from '@/constants'

interface Params {
  type: string
}
export async function generateStaticParams() {
  return PostDir.map((type) => ({
    type,
  }))
}

interface ListProps {
  params: Params
}

async function ArtList({ params }: ListProps) {
  const type = params.type
  return (
    <ArtlistAll
      params={{
        type,
        pagenum: '1',
      }}
    />
  )
}
export default ArtList