Skip to content

Commit 2240e1d

Browse files
committed
docs: add explanation of {{ pathPrefix }} usage for internal links and assets
1 parent 4563528 commit 2240e1d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

.github/DEVELOPMENT.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,14 @@ Saving project files will make Node.js regenerate the website to reflect the cha
156156

157157
Make sure you edit the files in the `src/` subdirectory. Any edits made in the `_site` subdirectory will be overwritten by the next change to any file in `src/` and all your hard work will be lost!
158158

159+
### About `{{ pathPrefix }}`
160+
161+
The `{{ pathPrefix }}` variable is used throughout the site to ensure all internal links and asset URLs work correctly, whether the site is deployed as the main repository or as a fork (such as on GitHub Pages).
162+
163+
On the main site, `{{ pathPrefix }}` is an empty string (""), so URLs are relative to the root.
164+
165+
On a fork, `{{ pathPrefix }}` is set to the repository name (e.g., "`/gc-da11yn.github.io`"), so all links and assets are correctly prefixed. Always use `{{ pathPrefix }}` for internal links and assets in templates and markdown files to ensure robust navigation in all deployment scenarios.
166+
159167
### Quitting
160168

161169
You can tell Node.js to stop running by pressing the <kbd>Control</kbd> and <kbd>C</kbd> keys at the same time in your command line application, or by closing the command line application window or tab.
@@ -462,6 +470,14 @@ En sauvegardant les fichiers du projet, Node.js régénérera le site Web pour r
462470

463471
Assurez-vous d'éditer les fichiers dans le sous-répertoire `src/`. Toute modification faite dans le sous-répertoire `_site` sera écrasée par la prochaine modification d'un fichier dans `src/` et tout votre travail sera perdu !
464472

473+
### À propos de `{{ pathPrefix }}`
474+
475+
La variable `{{ pathPrefix }}` est utilisée sur tout le site pour garantir que tous les liens internes et les ressources fonctionnent correctement, que le site soit déployé sur le dépôt principal ou sur un fork (par exemple sur GitHub Pages).
476+
477+
Sur le site principal, `{{ pathPrefix }}` est une chaîne vide (""), donc les URLs sont relatives à la racine.
478+
479+
Sur un fork, `{{ pathPrefix }}` prend le nom du dépôt (ex. : "`/gc-da11yn.github.io`"), ce qui permet de préfixer correctement tous les liens et ressources. Utilisez toujours `{{ pathPrefix }}` pour les liens internes et les ressources dans les modèles et fichiers markdown afin d’assurer une navigation robuste dans tous les scénarios de déploiement.
480+
465481
### Quitter
466482

467483
Vous pouvez demander à Node.js d'arrêter de s'exécuter en appuyant simultanément sur les touches <kbd>Control</kbd> et <kbd>C</kbd> dans votre application de ligne de commande, ou en fermant la fenêtre ou l'onglet de l'application de ligne de commande.

0 commit comments

Comments
 (0)