Fizer Khan
Fizer Khan

Reputation: 92725

Way to serve a "public" folder in github pages

I have personal blog in github repo myname.github.io, i generates my site contents using Cabin site generator which generate build files in public folder. I wanted to serve the contents from public folder for Github pages. But it is always looking at the root folder.

Is there any option to tell Github to serve contents from public folder, not from root folder?

Upvotes: 8

Views: 5621

Answers (1)

Reni
Reni

Reputation: 408

  1. Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).
  2. Make sure git knows about your subtree (the subfolder with your site). git add dist && git commit -m "Initial dist subtree commit"
  3. Use subtree push to send it to the gh-pages branch on GitHub. git subtree push --prefix dist origin gh-pages Source: https://gist.github.com/cobyism/4730490

  4. Go to the settings of the project and set the gh-pages as the branch for the website

Upvotes: 4

Related Questions