How to Create More Than One Repository for Github Pages

Can I create more than one repository for github pages?

You can have one site published to https://<username>.github.io by publishing to the master branch of a repository named “username.github.io” (substituting your actual username).

You can also have an additional site per GitHub project published to https://<username>.github.io/<project>. Project settings let you choose which branch and directory to publish.

A better description is available in the GitHub Pages documentation, including options for using custom domain names.

(since April 2013, all username.github.com are now username.github.io)

How to create more than one github page in one account using another repository

You can enable the github pages from the settings option of the repository. There you can also select the branch from the drop-down. For more details on the github pages feature please read this documentation here.

Also this link might be of use as well.

Multiple pages in single repository?

Yes just create files and directories

Check the doc at
https://docs.github.com/en/pages/getting-started-with-github-pages/creating-a-github-pages-site#next-steps

You can add more pages to your site by creating more new files. Each file will be available on your site in the same directory structure as your publishing source. For example, if the publishing source for your project site is the gh-pages branch, and you create a new file called /about/contact-us.md on the gh-pages branch, the file will be available at https://.github.io//about/contact-us.html.

Host multiple GitHub websites

If you want three separate .github.io URLs, like this:

  • https://foo.github.io
  • https://bar.github.io
  • https://baz.github.io

...then you have no other choice but create one separate GitHub account for each site.

Obviously you can have only one http:/username.github.io URL per username :-)


But there's another solution: you can have one static page for each repository.

This is called Project Pages.

You can create three repositories, one per static site you want:

  • https://github.com/username/site1
  • https://github.com/username/site2
  • https://github.com/username/site3

Follow the instructions and you can have three static sites with URLs like this:

  • https://username.github.io/site1
  • https://username.github.io/site2
  • https://username.github.io/site3

Use Github pages on multiple repositories when one has a custom CNAME already?

As of Aug 2016, I don't think this is possible. (https://help.github.com/articles/custom-domain-redirects-for-github-pages-sites/)

The Github Pages help article states that

Project Pages site owned by a user account, such as username.github.io/projectname, will be Automatically redirected to a subdirectory of a User Pages site custom domain (user.example.com/projectname), unless a different CNMAE is specified, such as project.example.com

See Github pages - Disable custom domain redirection for all but a single site?

How to use GitHub Actions with multiple repositories and deploy to GitHub Pages?

The easiest way to do this would be to add a workflow to each repository that updates the corresponding area in Pages. I.e. in the "Main" repo, it would look something like:

on: push

jobs:
main:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build
run: TODO

- name: Publish
run: TODO

And in the other repositories, you'd have something similar. For example in the Angular repository:

on: push

jobs:
angular:
steps:
- name: Checkout App
uses: actions/checkout@v2

- name: Build Angular
run: |
npm ci
npm run build
ng build --prod --base-href='angular'

- name: Publish
run: TODO

If you wanted to only publish when you update Main, you could have a workflow in your Main repository that builds and publishes all three, e.g.:

on: push

jobs:
main:
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: my-org/main
path: main

- name: Build
run: TODO
working-directory: ./main

- name: Publish
run: TODO
working-directory: ./main

react:
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
repository: my-org/react
path: react

- name: Build React
run: TODO
working-directory: ./react

- name: Publish
run: TODO
working-directory: ./react

angular:
steps:
- name: Checkout App
uses: actions/checkout@v2
with:
repository: my-org/angular
path: angular

- name: Build Angular
run: |
npm ci
npm run build
ng build --prod --base-href='angular',
working-directory: ./angular

- name: Publish
run: TODO
working-directory: ./angular


Related Topics



Leave a reply



Submit