仅在deploy nextjs应用程序时,仅在github页面上显示redeme.md

发布于 2025-02-08 17:54:21 字数 1329 浏览 1 评论 0原文

我试图在github页面上显示我的下一个博客,但只显示了读数文件。部署时我不会遇到错误。 repolink

  • 设置中的github页面分支是gh-pages/root
  • i i已安装了Next.config.js的GH-PAGES依赖项
  • 已更新

const isProd = process.env.NODE_ENV === 'production'

module.exports = {
  reactStrictMode: true,
  images: {
    loader: 'akamai',
    path: '',
  },
  assetPrefix: isProd ? '/mdxblog/' : ''
}

  • gh-pages.desploy.yml
name: Deploy to GitHub Pages


on:
    push:
    branches: [main]


jobs:
    build:
    runs-on: ubuntu-latest
    defaults:
        run:
        working-directory: ./src

    env:
        NEXT_PUBLIC_BASE_PATH: /mdxblog

    strategy:
        matrix:
        node-version: [14.x]


    steps:
        - name: Get files
        uses: actions/checkout@v2
        with:
            persist-credentials: false

        - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
            node-version: ${{ matrix.node-version }}
        run: npm ci
        run: npm run build
        run: npm run export
        run: touch ./out/.nojekyll

        - name: Deploy 
              

I tried to display my Next.js blog on Github pages, but only the README file is displayed. I do not get errors when deploying.
repolink

  • The github pages branch in settings is gh-pages /root
  • I have installed the gh-pages dependencies
  • updated next.config.js is below

const isProd = process.env.NODE_ENV === 'production'

module.exports = {
  reactStrictMode: true,
  images: {
    loader: 'akamai',
    path: '',
  },
  assetPrefix: isProd ? '/mdxblog/' : ''
}

  • gh-pages.desploy.yml
name: Deploy to GitHub Pages


on:
    push:
    branches: [main]


jobs:
    build:
    runs-on: ubuntu-latest
    defaults:
        run:
        working-directory: ./src

    env:
        NEXT_PUBLIC_BASE_PATH: /mdxblog

    strategy:
        matrix:
        node-version: [14.x]


    steps:
        - name: Get files
        uses: actions/checkout@v2
        with:
            persist-credentials: false

        - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
            node-version: ${{ matrix.node-version }}
        run: npm ci
        run: npm run build
        run: npm run export
        run: touch ./out/.nojekyll

        - name: Deploy ????
        uses: JamesIves/[email protected]
        with:
            branch: gh-pages # The branch the action should deploy to.
            folder: out # The folder the action should deploy.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文