Install_doks_theme_gitlab_pages

Create a gitlab project

Name: andrewmercer.gitlab.io

  • check initialize with README (to create the main branch)

Install the doks theme

git clone git@gitlab.com:andrewmercer/andrewmercer.gitlab.io.git
  • https://getdoks.org/docs/start-here/installation
npm create thulite@latest andrewmercer.gitlab.io -- --template doks

When prompted, select ignore files and install (or something similar)

todo: (how to confirm ignore files and continue options)

cd andrewmercer.gitlab.io
npm install
git checkout -b install_hugo_doks
git add .
git commit -am "This is fresh installation of hugo doks"
git push --set-upstream origin install_hugo_doks
  • https://docs.gitlab.com/topics/git/merge
  • https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging
git checkout main
git pull origin main
git merge install_hugo_doks
git add .
git commit
git push origin main

Add your customized domain, gitlab-ci, secure the repo, etc

Create a .gitlab-ci.yml file

  • Deploy => Pages => GitLab will start an an interactive process to add a .gitlab-ci.yml file
  • Copy and paste the following into the code window to the right:
variables:
  DART_SASS_VERSION: 1.64.1
  HUGO_VERSION: 0.145.0
  NODE_VERSION: 20.x
  GIT_DEPTH: 0
  GIT_STRATEGY: clone
  GIT_SUBMODULE_STRATEGY: recursive
  TZ: America/Toronto

image: node:lts
# Functions that should be executed before the build script is run
before_script:
  - npm ci
pages:
  script:
    - apt-get update
    - apt-get install -y brotli
    - curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
    - tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz
    - cp -r dart-sass/ /usr/local/bin
    - rm -rf dart-sass*
    - export PATH=/usr/local/bin/dart-sass:$PATH
    - curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
    - apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
    - rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
    - npm run build
  artifacts:
    paths:
      # The folder that contains the files to be exposed at the Page URL
      - public
  rules:
    # This ensures that only pushes to the default branch will trigger
    # a pages deploy
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

Add your domain

  • Domain & settings => Add domain => www.andrewmercer.net => Automatic certificate management using Let’s Encrypt: check => Create new domain
  • Enforce primary domain: www.andrewmercer.net

Secure the repo

I don’t know if this has changed, in the past everyone in the world could look at the code, but if you lock it down to just Pages with access to Everyone with Access, a lot of other things become unavailable publicly.

  • lock down to Pages only access to everyone

Pages => General => Visibility