GitLab Pages: How to configure .gitlab-ci.yml to work with one's own directory structure

Suppose I make a website with a basic directory structure:

  • assets
  • documents
  • icons
  • images
  • source
  • css
  • js
  • pages
  • home.html
  • another-page.html

and I want to host it on GitLab Pages.

How do I correctly configured the .gitlab-ci.yml file?

All the paths within the website are relative, and it should require not additional set-up - so there are no scrips to run…

The set-up pages page states to host plain html all one needs is this:

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

but that is only for hosting the master branch… So how do I configure the path to make ./pages/home.html the main page?

Is there any reason why all your pages are being stored in a sub-directory? Even if you weren’t using Gitlab you’d be having the same issue. On an Apache server you’d have to add some kind of htaccess redirect from / to /pages/home.html.

I’d personally suggest having the following folder structure, this is standard on most static websites:

  • assets
  • documents
  • icons
  • images
  • source
  • css
  • js
  • home.html
  • another-page.html

I don’t think there’s any way to tell Gitlab Pages what your homepage URL is.

Having the sub-directory just seems cleaner to me…
Either way if there isn’t a way to tell gitlab which page is home, then that seems like a problem?