仅在deploy nextjs应用程序时,仅在github页面上显示redeme.md
我试图在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论