From c335773d30fcfe9a495d0b5a5517283663c06bf9 Mon Sep 17 00:00:00 2001 From: greg Date: Sat, 30 Mar 2024 19:17:12 +0100 Subject: [PATCH] maj README --- README.md | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 209 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index db3bef9..e34c808 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,217 @@ # HUGO CV :necktie: -[HUGO](https://gohugo.io/) framework pour créer son CV en 2 minutes +[![HUGO LOGO](docs/hugo-logo.svg)](https://gohugo.io) -## UTILISATION :rocket: +## INSTALLATION :hammer: -> https://docs.legaragenumerique.xyz/divers/devops/hugo/ +- Via APT: +```bash +sudo apt install hugo +``` -## THEME +- Via la ligne de commande: +```bash +cd /tmp +curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest \ + | grep browser_download_url \ + | grep linux-amd64.deb \ + | grep extended \ + | cut -d '"' -f 4 \ + | wget -i - -Le theme utilisé est [ALMEIDA CV](https://github.com/ineesalmeida/almeida-cv) +sudo dpkg -i hugo*_linux-amd64.deb +rm -rf hugo*_linux-amd64.deb +``` + +## UTILISATION + +### CREATION DU SITE :page_with_curl: + +- Vérifier l'installation: +```bash +hugo version +``` + +- Créer la structure du site: +```bash +hugo new site mon-site +``` + +- Créer du contenu: +```bash +cd mon-site +hugo new posts/mon-post.md +nano posts/mon-post.md +``` + +Ajouter des medias: +- images: +```bash +## Image via link: +![](https://pbs.twimg.com/media/DGKRMoPXcAIyA8y.jpg) + +------ + +## Image via url locale (/static): +![](/images/test/1.png) +``` +- videos: +```bash +## Vidéo Youtube: +{{< youtube ZSWzPI4BqvA >}} +``` + +### AJOUT D'UN THEME :art: + +```bash +git init +git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke +echo theme = \"ananke\" >> config.toml +``` + +Les thèmes HUGO: +- https://jamstackthemes.dev/ssg/hugo/ +- https://hugothemesfree.com/ +- https://master--hugothemes.netlify.app/ + +### CONFIGURATION DU CONFIG.TOML :wrench: + +- Configuration de base +```bash +# Configuration de l'adresse, titre (onglet) et des chemins vers les contenus +baseurl = "/" +contentdir = "content" +layoutdir = "layouts" +publishdir = "public" +title = "Mon super site!!!" +canonifyurls = true + +# ACCUEIL +[Params] + subtitle = "Portfolio made in HUGO !" + logo = "img/logo2.png" + favicon = "img/favicon.ico" + dateFormat = "January 2, 2006" + commit = false + rss = false + comments = true +``` + +- Création d'un menu +```bash +[[menu.main]] + name = "Post 1" + url = "/post/post1" + weight = 1 + +[[menu.main]] + name = "A propos" + url = "/page/about" + weight = 2 + +[[menu.main]] + name = "Projets" + url = "/page/about" + weight = 3 +``` + +- Création d'un sous menu +```bash +[[menu.main]] + parent = "Projets" + name = "Projet 1" + url = "/projets/projet1" + weight = 1 + +[[menu.main]] + parent = "Projets" + name = "Projet 2" + url = "/projets/projet2" + weight = 2 +``` + +:warning: Créer les dossiers et les fichiers correspondant. Les urls ne prennent pas l'extension .md du fichier + +- Création des icônes reseaux sociaux +```bash +[Author] + name = "" + email = "" + gitlab = "" + github = "" + twitter = "" + reddit = "" + linkedin = "" +``` + +### LANCER LE SERVEUR :rocket: + +```bash +# L'option -D est pour servir les fichiers en Draft = true (non publiés) +hugo server -D +``` + +> Visiter http://localhost:1313 + + +### BUILDER LE SITE :construction: + +```bash +hugo +``` + +> Les fichiers générés sont dans le dossier public + +## DEPLOIEMENT :checkered_flag: + +### VIA GITLAB AUTO DEVOPS + +Compléter le config.toml comme ceci: +```bash +baseURL = "https://gitlab_user.gitlab.io/" +``` + +Compléter le fichier .gitlab-ci.yml comme ceci: +```bash +image: registry.gitlab.com/pages/hugo/hugo_extended:latest + +variables: + GIT_SUBMODULE_STRATEGY: recursive + +pages: + script: + - hugo + artifacts: + paths: + - public + only: + - main +``` + +### VIA DOCKER :whale: + +- Créer une Dockerfile contenant: + +```Dockerfile +FROM nginx:alpine + +COPY ./public/* /usr/share/nginx/html +COPY ./docs/nginx-exemple.conf /etc/nginx/conf.d/default.conf + +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] +``` + +```bash +docker build -t hugo-site:1.0 . +docker run -d -p 8989:80 hugo-site:1.0 +``` + +## DOCUMENTATION :books: + +[DOC DU GARAGE](https://docs.legaragenumerique.xyz/divers/devops/hugo/) +[DOC OFFICIELLE](https://gohugo.io/documentation/) +[DOC MARKDOWN](https://www.markdownguide.org/basic-syntax/) ## CI/CD :repeat: @@ -17,4 +220,4 @@ Le theme utilisé est [ALMEIDA CV](https://github.com/ineesalmeida/almeida-cv) ## TO DO :bookmark_tabs: -- [ ] CI/CD schema +- [ ] CI/CD schema \ No newline at end of file