16 KiB
Jekyll - chirpy
Configuration native
recommandée pour les systèmes d'exploitation de type Unix
Pour les systèmes de type Unix, vous pouvez configurer l'environnement de manière native pour des performances optimales.
- Suivre le guide d'installation de Jekyll(en) pour installer Jekyll et vous assurer que Git est installé.
- Cloner le dépôt sur votre machine locale:
git clone https://github.com/cotes2020/jekyll-theme-chirpy.git
- Si vous avez forké le thème, installez Node.js et exécutez
bash tools/init.sh
dans le répertoire racine$HOME/media/jekyll-theme-chirpy
pour initialiser le dépôt. - Exécutez la commande
bundle
à la racine de votre dépôt pour installer les dépendances.
chirpy
Se positionner dans le dossier
cd ~/media/chirpy
Le fichier _config.yml
(Afficher/Cacher) _config.yml
{% highlight yaml %}
The Site Configuration
Import the theme
theme: jekyll-theme-chirpy
The language of the webpage › http://www.lingoes.net/en/translator/langcode.htm
If it has the same name as one of the files in folder _data/locales
, the layout language will also be changed,
otherwise, the layout language will use the default value of 'en'.
lang: fr-FR
Change to your timezone › https://kevinnovak.github.io/Time-Zone-Picker
timezone:
jekyll-seo-tag settings › https://github.com/jekyll/jekyll-seo-tag/blob/master/docs/usage.md
↓ --------------------------
title: YannStatic # the main title
tagline: Un thème Jekyll axé sur le texte # it will display as the subtitle
description: >- # used by seo meta and the atom feed Un thème Jekyll minimal, réactif et riche en fonctionnalités pour la rédaction technique.
Fill in the protocol & hostname for your site.
E.g. 'https://username.github.io', note that it does not end with a '/'.
url: "https://yann.rnmkcy.eu"
github: username: github_username # change to your GitHub username
twitter: username: twitter_username # change to your Twitter username
social:
Change to your full name.
It will be displayed as the default author of the posts and the copyright owner in the Footer
name: Yann email: static@rnmkcy.eu # change to your email address links: # The first element serves as the copyright owner's link # - https://twitter.com/username # change to your Twitter homepage # - https://github.com/username # change to your GitHub homepage # Uncomment below to add more social links # - https://www.facebook.com/username # - https://www.linkedin.com/in/username
Site Verification Settings
webmaster_verifications: google: # fill in your Google verification code bing: # fill in your Bing verification code alexa: # fill in your Alexa verification code yandex: # fill in your Yandex verification code baidu: # fill in your Baidu verification code facebook: # fill in your Facebook verification code
↑ --------------------------
The end of jekyll-seo-tag
settings
Web Analytics Settings
analytics: google: id: # fill in your Google Analytics ID goatcounter: id: # fill in your GoatCounter ID umami: id: # fill in your Umami ID domain: # fill in your Umami domain matomo: id: # fill in your Matomo ID domain: # fill in your Matomo domain cloudflare: id: # fill in your Cloudflare Web Analytics token fathom: id: # fill in your Fathom Site ID
Page views settings
pageviews: provider: # now only supports 'goatcounter'
Prefer color scheme setting.
Note: Keep empty will follow the system prefer color by default,
and there will be a toggle to switch the theme between dark and light
on the bottom left of the sidebar.
Available options:
light — Use the light color scheme
dark — Use the dark color scheme
theme_mode: dark # [light | dark]
The CDN endpoint for media resources.
Notice that once it is assigned, the CDN url
will be added to all media resources (site avatar, posts' images, audio and video files) paths starting with '/'
e.g. 'https://cdn.com'
cdn:
the avatar on sidebar, support local or CORS resources
avatar:
The URL of the site-wide social preview image used in SEO og:image
meta tag.
It can be overridden by a customized page.image
in front matter.
social_preview_image: # string, local or CORS resources
boolean type, the global switch for TOC in posts.
toc: true
comments:
Global switch for the post-comment system. Keeping it empty means disabled.
provider: # [disqus | utterances | giscus]
The provider options are as follows:
disqus: shortname: # fill with the Disqus shortname. › https://help.disqus.com/en/articles/1717111-what-s-a-shortname
utterances settings › https://utteranc.es/
utterances: repo: # / issue_term: # < url | pathname | title | ...>
Giscus options › https://giscus.app
giscus:
repo: # /
repo_id:
category:
category_id:
mapping: # optional, default to 'pathname'
strict: # optional, default to '0'
input_position: # optional, default to 'bottom'
lang: # optional, default to the value of site.lang
reactions_enabled: # optional, default to the value of 1
Self-hosted static assets, optional › https://github.com/cotes2020/chirpy-static-assets
assets:
self_host:
enabled: # boolean, keep empty means false
# specify the Jekyll environment, empty means both
# only works if assets.self_host.enabled
is 'true'
env: # [development | production]
pwa:
enabled: true # The option for PWA feature (installable)
cache:
enabled: true # The option for PWA offline cache
# Paths defined here will be excluded from the PWA cache.
# Usually its value is the baseurl
of another website that
# shares the same domain name as the current website.
deny_paths:
# - "/example" # URLs match <SITE_URL>/example/*
will not be cached by the PWA
paginate: 10
The base URL of your site
baseurl: ""
------------ The following options are not recommended to be modified ------------------
kramdown: footnote_backlink: "↩︎" syntax_highlighter: rouge syntax_highlighter_opts: # Rouge Options › https://github.com/jneen/rouge#full-options css_class: highlight # default_lang: console span: line_numbers: false block: line_numbers: true start_line: 1
collections: tabs: output: true sort_by: order
defaults:
- scope:
path: "" # An empty string here means all files in the project
type: posts
values:
layout: post
comments: true # Enable comments in posts.
toc: true # Display TOC column in posts.
DO NOT modify the following parameter unless you are confident enough
to update the code of all other post links in this project.
permalink: /posts/:title/ - scope: path: _drafts values: comments: false
- scope:
path: ""
type: tabs # see
site.collections
values: layout: page #permalink: /:title/ permalink: /:title/
sass: style: compressed
compress_html: clippings: all comments: all endings: all profile: false blanklines: false ignore: envs: [development]
exclude:
- "*.gem"
- "*.gemspec"
- docs
- tools
- README.md
- LICENSE
- purgecss.js
- rollup.config.js
- "package*.json"
enabled: [categories, tags]
jekyll-archives: enabled: [tags] layouts: # category: category tag: tag permalinks: tag: /tags/:name/ # category: /categories/:name/ {% endhighlight %}
Le fichier Gemfile $HOME/media/chirpy/Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
gemspec
gem "html-proofer", "~> 5.0", group: :test
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end
gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin]
Supprimer , si existant, le fichier Gemfile.lock
Bundle lit le fichier Gemfile
bundle # Patientez ...
Bundle complete! 5 Gemfile dependencies, 64 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Info sur jekyll et créer un lien
bundle info jekyll
* jekyll (4.4.1)
Summary: A simple, blog aware, static site generator.
Homepage: https://jekyllrb.com
Source Code: https://github.com/jekyll/jekyll
Changelog: https://github.com/jekyll/jekyll/releases
Bug Tracker: https://github.com/jekyll/jekyll/issues
Path: /home/yann/.local/share/gem/ruby/3.3.0/gems/gems/jekyll-4.4.1
Reverse Dependencies:
jekyll-archives (2.3.0) depends on jekyll (>= 3.6, < 5.0)
jekyll-include-cache (0.2.1) depends on jekyll (>= 3.7, < 5.0)
jekyll-redirect-from (0.16.0) depends on jekyll (>= 3.3, < 5.0)
jekyll-seo-tag (2.8.0) depends on jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0) depends on jekyll (>= 3.7, < 5.0)
jekyll-theme-chirpy (7.2.4) depends on jekyll (~> 4.3)
Création des liens sur les dossiers files , images , _posts et htmldoc
ln -s /srv/media/statique/images /srv/media/chirpy/images
ln -s /srv/media/statique/files /srv/media/chirpy/files
#ln -s /srv/media/statique/_posts /srv/media/chirpy/_posts
#ln -s /srv/media/statique/htmldoc /srv/media/chirpy/htmldoc
#ln -s /srv/media/statique/htmldoc/htmldoc.md /srv/media/chirpy/htmldoc.md
Génération dossier "_site"
Création du dossier _site
cd ~/media/chirpy
bundle exec jekyll build
Configuration file: /srv/media/chirpy/_config.yml
Theme Config file: /srv/media/chirpy/_config.yml
Source: /srv/media/chirpy
Destination: /srv/media/chirpy/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 56.715 seconds.
Auto-regeneration: disabled. Use --watch to enable.
Service chirpy
On veut générer un dossier nommé '_site'
{:.success}
PATH Jekyll : which bundle
→ /home/yann/.local/share/gem/ruby/3.3.0/bin/bundle
Pour lancer le serveur chirpy au démarrage, utilisation d'un service systemd utilisateur
Les variables environnement, générer le fichier
env > /srv/media/chirpy/.env_file
Création d'un service utilisateur "chirpy" sous systemd
mkdir -p ~/.config/systemd/user
nano ~/.config/systemd/user/chirpy.service
Contenu du fichier chirpy.service
[Unit]
Description=service chirpy
[Service]
EnvironmentFile=/srv/media/chirpy/.env_file
WorkingDirectory=/srv/media/chirpy
ExecStart=/home/yann/.local/share/gem/ruby/3.3.0/bin/bundle exec jekyll build --watch --incremental
Restart=on-abort
[Install]
WantedBy=default.target
Lancer le service chirpy :
systemctl --user daemon-reload
systemctl --user start chirpy
Vérifier
systemctl --user status chirpy
● chirpy.service - service chirpy
Loaded: loaded (/home/yann/.config/systemd/user/chirpy.service; disabled; preset: enabled)
Active: active (running) since Sat 2025-03-15 10:28:22 CET; 1min 23s ago
Invocation: 99afaffc67144cd4bbc2c0820318b76c
Main PID: 29581 (bundle)
Tasks: 4 (limit: 38066)
Memory: 1.3G (peak: 1.3G)
CPU: 58.858s
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/chirpy.service
└─29581 "/home/yann/.local/share/gem/ruby/3.3.0/gems/bin/jekyll build --watch --incremental"
mars 15 10:28:22 PC1 systemd[1494]: Started service chirpy.
mars 15 10:28:23 PC1 bundle[29581]: Configuration file: /srv/media/chirpy/_config.yml
mars 15 10:28:23 PC1 bundle[29581]: Theme Config file: /srv/media/chirpy/_config.yml
mars 15 10:28:23 PC1 bundle[29581]: Source: /srv/media/chirpy
mars 15 10:28:23 PC1 bundle[29581]: Destination: /srv/media/chirpy/_site
mars 15 10:28:23 PC1 bundle[29581]: Incremental build: enabled
mars 15 10:28:23 PC1 bundle[29581]: Generating...
mars 15 10:29:21 PC1 bundle[29581]: done in 58.193 seconds.
mars 15 10:29:21 PC1 bundle[29581]: Auto-regeneration: enabled for '/srv/media/chirpy'
Activation
systemctl --user enable chirpy
dire à systemd que l’instance d’un utilisateur soit tout le temps présente, du boot au shutdown, ce qui permet d’avoir des processus (services) utilisateurs qui tournent sans avoir de session ouverte.
sudo loginctl enable-linger $USER
Pour observer le fonctionnement du service chirpy depuis la machine virtuelle debian
journalctl -f --user-unit chirpy.service
Synchro serveur dossier "_site"
Le but est de synchroniser le dossier ~/media/chirpy/_site avec le(s) serveur(s) web distant(s)
A chaque création, modification ou suppression d'un POST mardown le sous-dossier _site/ est reconstruit (jekyll build
)
Avec les unités de chemin, vous pouvez surveiller les fichiers et les répertoires pour certains événements. Si un événement spécifique se produit, une unité de service est exécutée, et elle porte généralement le même nom que l'unité de chemin
{:.info}
Nous allons surveiller dans le dossier /home/yann/media/chirpy/_site/ toute modification du fichier sitemap.xml qui entrainera l'exécution d'un script
Dans le répertoire systemd utilisateur nous créons une unité de cheminement media_chirpy_site.path
nano ~/.config/systemd/user/media_chirpy_site.path
[Unit]
Description=Surveiller sitemap.xml pour les changements
[Path]
PathChanged=/home/yann/media/chirpy/_site/sitemap.xml
Unit=media_chirpy_site.service
[Install]
WantedBy=default.target
Dans la section [Path]
, PathChanged=
indique le chemin absolu du fichier à surveiller, tandis que Unit=
indique l'unité de service à exécuter si le fichier change. Cette unité (media_chirpy_site.path) doit être lancée lorsque le système est en mode multi-utilisateur.
Ensuite, nous créons l'unité de service correspondante, media_chirpy_site.service, dans le répertoire ~/.config/systemd/user/
Si le fichier sitemap.xml change (c'est-à-dire qu'il est à la fois écrit et fermé), l'unité de service suivante sera appelée pour exécuter le script spécifié :
nano ~/.config/systemd/user/media_chirpy_site.service
[Unit]
Description="Exécute le script si site.xml a été modifié."
[Service]
ExecStart=/home/yann/scripts/media_chirpy_site.sh
Le script /home/yann/scripts/media_chirpy_site.sh
lance une synchronisation locale distante via rsync ssh
Etendre Réduire media_chirpy_site.sh
{% highlight shell %} {% endhighlight %}Le rendre exécutable
chmod +x /home/yann/scripts/media_chirpy_site.sh
Activation et lancement
systemctl --user enable media_chirpy_site.path --now
Voir le fichier journal
journalctl --user -f -u media_chirpy_site.service
On peut créer un accès graphique sur le poste archlinux
~/.local/share/applications/suivi_chirpy_site.desktop
[Desktop Entry]
Version=1.1
Type=Application
Name=Synchro modification site
Comment=suivi_chirpy_site.sh
Icon=xterm-color_48x48
Exec=xterm -rv -geometry 290x40+100+150 -T suivi_chirpy_site -e '/home/yann/scripts/suivi_chirpy_site.sh'
Actions=
Categories=Utility;
Path=
Terminal=false
StartupNotify=false
Le script
~/scripts/suivi_chirpy_site.sh
#!/bin/bash
# COLUMNSxROWS+X+Y -> xterm -geometry 400x200+100+350
# xterm -rv -geometry 150x40+100+150 -T suivi_chirpy_site -e '/home/yann/scripts/suivi_chirpy_site.sh'
# On supprime la session "lxcSess" si existante
if [[ `tmux list-sessions | grep 'lxcSess' | wc -l` != 0 ]]
then
# On ferme la session active
tmux kill-session -t lxcSess
fi
# Créer une bannière dans /etc/motd sur chaque serveur
# Nom du domaine en ascii voir lien http://patorjk.com/software/taag/#p=display&h=1&f=Small
echo "fin fi"
# Créer session + terminal
tmux new -d -s lxcSess -n lxcTerm
# Séparation horizontale en 2 du terminal
tmux split-window -v -p 50
# | 0 |
# | |
# |-----------|
# | 1 |
# | |
# Sélection terminal HAUT
tmux selectp -t 0
#
tmux send-keys -t lxcSess "journalctl --user -f -u chirpy.service" C-m
# Sélection terminal BAS
tmux selectp -t 1
#
tmux send-keys -t lxcSess "journalctl --user -f -u media_chirpy_site.service" C-m
# Afficher la session
tmux a -t lxcSess
#
# Tuer la session
# tmux kill-session -t lxcSess
Le rendre exécutable
chmod +x scripts/suivi_chirpy_site.sh