How to make new Mkdocs in gitlab.com

Make new Repositry

New project

Project name

New repo

Copy mkdocs from gitlab example

https://gitlab.com/pages/mkdocs

GitLab CI
image: python:3.8-buster

before_script:
  - pip install -r requirements.txt

test:
  stage: test
  script:
  - mkdocs build --strict --verbose --site-dir test
  artifacts:
    paths:
    - test
  except:
  - master

pages:
  stage: deploy
  script:
  - mkdocs build --strict --verbose
  artifacts:
    paths:
    - public
  only:
  - master

git clone

in terminal
$ cd gitlab-fablabkannai/
$ ls
corona  eggbot
$ git clone git@gitlab.com:pages/mkdocs.git
Cloning into 'mkdocs'...
Resolving deltas: 100% (19/19), done.
$ ls
corona  eggbot  mkdocs
$ mv mkdocs music_box
$ ls
corona      eggbot      music_box
$ cd music_box/
$ ls -la
total 40
drwxr-xr-x   9 yuichitamiya  staff   288  8  2 22:28 .
drwxr-xr-x   7 yuichitamiya  staff   224  8  2 22:30 ..
drwxr-xr-x  12 yuichitamiya  staff   384  8  2 22:28 .git
-rw-r--r--   1 yuichitamiya  staff     8  8  2 22:28 .gitignore
-rw-r--r--   1 yuichitamiya  staff   342  8  2 22:28 .gitlab-ci.yml
-rw-r--r--   1 yuichitamiya  staff  2567  8  2 22:28 README.md
drwxr-xr-x   3 yuichitamiya  staff    96  8  2 22:28 docs
-rw-r--r--   1 yuichitamiya  staff    93  8  2 22:28 mkdocs.yml
-rw-r--r--   1 yuichitamiya  staff   209  8  2 22:28 requirements.txt

Prepare to push new repo

find username of gitlab

change mkdocs.yml

Tamiyas-MacBookPro-7:music_box yuichitamiya$ ls -la
total 40
drwxr-xr-x   9 yuichitamiya  staff   288  8  2 22:28 .
drwxr-xr-x   7 yuichitamiya  staff   224  8  2 22:30 ..
drwxr-xr-x  12 yuichitamiya  staff   384  8  2 22:28 .git
-rw-r--r--   1 yuichitamiya  staff     8  8  2 22:28 .gitignore
-rw-r--r--   1 yuichitamiya  staff   342  8  2 22:28 .gitlab-ci.yml
-rw-r--r--   1 yuichitamiya  staff  2567  8  2 22:28 README.md
drwxr-xr-x   3 yuichitamiya  staff    96  8  2 22:28 docs
-rw-r--r--   1 yuichitamiya  staff    93  8  2 22:28 mkdocs.yml
-rw-r--r--   1 yuichitamiya  staff   209  8  2 22:28 requirements.txt
Tamiyas-MacBookPro-7:music_box yuichitamiya$ nano mkdocs.yml 

mkdocs.yml

from

site_name: My Docs by GitLab Pages
site_url: https://pages.gitlab.io/mkdocs
site_dir: public

to

site_name: music box              
site_url: https://fablabkannai.gitlab.io                               
site_dir: public

Ctl+x > yes > Return

find instracton from new repo site

Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@gitlab.com:fablabkannai/music_box.git
git push -u origin --all
git push -u origin --tags

in terminal

$ cd music_box
$ git remote -v
origin  git@gitlab.com:pages/mkdocs.git (fetch)
origin  git@gitlab.com:pages/mkdocs.git (push)
$ git remote rename origin old-origin
$ git remote add origin git@gitlab.com:fablabkannai/music_box.git
$ git remote -v
old-origin  git@gitlab.com:pages/mkdocs.git (fetch)
old-origin  git@gitlab.com:pages/mkdocs.git (push)
origin  git@gitlab.com:fablabkannai/music_box.git (fetch)
origin  git@gitlab.com:fablabkannai/music_box.git (push)
$ git push -u origin --all
To gitlab.com:fablabkannai/music_box.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
$ git push -u origin --tags
Everything up-to-date

repo to site

make page

Edit site

README.md

docs/index.md

New directory > img

chage theme

  • https://github.com/mkdocs/mkdocs/wiki/MkDocs-Themes
  • in Terminal
$ pip install mkdocs
$ mkdocs --version
mkdocs, version 0.15.3
$ pip install mkdocs-alabaster
  • Add to your mkdocs.yml: theme: alabaster