jzy*_*ert 5 github github-pages
只需设置我的GitHub Pages网站,据我所知,GitHub Pages将在父目录中查找index.html(即,如果我的仓库位于username.github.io中,它将在username中查找index.html。 github.io/index.html)。
如果无法在其中找到index.html,则会在页面上呈现我的README.md。
必须将index.html文件放到那里,还是有办法告诉Pages在username.github.io/src/index.html中查找该文件?
您可以尝试以下操作:在根目录创建一个虚拟的index.html 文件,然后将这行代码插入到head 标记内并为其指定正确的路径。
索引.html
<meta http-equiv="refresh" content="0;url=https://yourname.github.io/myapplication/frontend/public/index.html" />
Run Code Online (Sandbox Code Playgroud)
请注意,url 位于内容的引号内
小智 2
GitHub 现在让这一切变得简单。
当您尝试部署项目时,不要从分支部署它。相反,请使用该GitHub Action选项来执行此操作。
选择jekyll,然后将打开一个名为 , 的文件jekyll-gh-pages.yml,在其中,您需要将源更改为您想要的任何内容。
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./dist/ // CHANGE THAT TO WHATEVER YOU WANT
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
Run Code Online (Sandbox Code Playgroud)
这将成为默认文件夹./dist。