Reputation: 327
Just set up my GitHub Pages website and as far as I can tell, GitHub Pages will look for index.html in the parent directory (i.e. if my repo is in username.github.io, it will look for index.html in username.github.io/index.html).
If it cannot find index.html there, it renders out my README.md on the page instead.
Must the index.html file go there or is there a way to tell Pages to look for that file in let's say username.github.io/src/index.html?
Upvotes: 16
Views: 15811
Reputation: 151
GitHub has now made that easy.
When you try to deploy your project, don't deploy it from a branch. Instead, do that using the GitHub Action
option.
Choose jekyll
, then a file called jekyll-gh-pages.yml
, will open and inside it, you'll need to change the source to whatever you want.
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
This will make the default folder ./dist
.
Upvotes: 4
Reputation: 2604
You can try this: create a dummy index.html file at the root, and insert this line of code inside the head tag and give it the right path.
index.html
<meta http-equiv="refresh" content="0;url=https://yourname.github.io/myapplication/frontend/public/index.html" />
Note that the url is inside the content's quotations
Upvotes: 7
Reputation: 16283
according to this gist, by cobyism, you can use subtrees (not to be confused with the subtree merge strategy):
git subtree push --prefix <your-path> origin gh-pages
from the git-subtree docs on git's source code:
Subtrees allow subprojects to be included within a subdirectory of the main project, optionally including the subproject's entire history.
For example, you could include the source code for a library as a subdirectory of your application.
Upvotes: 0
Reputation: 440
No.
You would need to change the site source to change the directory where Jekyll will read files, but this is a configuration setting that you cannot change in GitHub Pages:
https://help.github.com/articles/configuring-jekyll/#configuration-settings-you-cannot-change
You can, however, change the source to the docs
folder in the settings of your GitHub repository.
See https://stackoverflow.com/a/41197820/2102854.
Upvotes: 2