From c2baa32b271ab6b0b535c91bec4108acf8cd8a27 Mon Sep 17 00:00:00 2001
From: Alexandre Caldato <caldato.alexandre@gmail.com>
Date: Sun, 10 Sep 2023 13:53:57 +0200
Subject: [PATCH 1/2] =?UTF-8?q?=C3=A9dition=20de=20la=20page?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dsfr/base.html     | 1 -
 dsfr/css/theme.css | 8 ++++++++
 dsfr/nav.html      | 9 ++++++++-
 mkdocs.yml         | 4 ++--
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dsfr/base.html b/dsfr/base.html
index 8d98050..48b48f5 100644
--- a/dsfr/base.html
+++ b/dsfr/base.html
@@ -36,7 +36,6 @@
     </title>
     {# {% block extrahead %}{% endblock %} #}
     {# {%- block libs %}
-    <script src="{{ 'js/jquery-1.10.2.min.js'|url }}" defer></script>
     <script src="{{ 'js/bootstrap.min.js'|url }}" defer></script>
     {%- endblock %} #}
 </head>
diff --git a/dsfr/css/theme.css b/dsfr/css/theme.css
index 3f09680..7276238 100644
--- a/dsfr/css/theme.css
+++ b/dsfr/css/theme.css
@@ -230,3 +230,11 @@ th {
 .revision-date {
     text-align: center;
 }
+
+@media (min-width: 62em) {
+    .fr-header .fr-nav {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+    }
+}
diff --git a/dsfr/nav.html b/dsfr/nav.html
index b62a897..6d28a6b 100644
--- a/dsfr/nav.html
+++ b/dsfr/nav.html
@@ -1,4 +1,4 @@
-<nav class="fr-nav" id="navigation-547" role="navigation" aria-label="Menu principal">
+<nav class="fr-nav navbar-header" id="navigation-547" role="navigation" aria-label="Menu principal">
 	<ul class="fr-nav__list">
 		{% for nav_item in nav %}
 			{% if not nav_item.children %}
@@ -21,4 +21,11 @@
 			{% endif %}
 		{% endfor %}
 	</ul>
+	{% if page.file %}
+	<a href="{{ config.repo_url }}{{ config.edit_uri }}{{ page.file.src_path }}" target="_blank" rel="noopener">
+		Éditer dans Gitlab Forge
+	</a>
+	{% endif %}
+
+
 </nav>
diff --git a/mkdocs.yml b/mkdocs.yml
index 8fb58ea..a1dbe0d 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -3,8 +3,8 @@ site_url: https://www.mkdocs.org/
 site_description: Project documentation with Markdown.
 site_author: MkDocs Team
 
-repo_url: https://github.com/mkdocs/mkdocs/
-edit_uri: blob/master/docs/
+repo_url: https://gitlab-forge.din.developpement-durable.gouv.fr/pub/numeco/mkdocs-dsfr/
+edit_uri: blob/main/docs/
 
 
 theme:
-- 
GitLab


From c039923f8a35bdfe81af4055a9cb174917d3020e Mon Sep 17 00:00:00 2001
From: Alexandre Caldato <caldato.alexandre@gmail.com>
Date: Sun, 10 Sep 2023 14:06:36 +0200
Subject: [PATCH 2/2] ajout de config

---
 README.md     | 27 +++++++++++++++++++++++++++
 dsfr/nav.html |  4 ++--
 mkdocs.yml    |  1 +
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 4ef0902..2ad96de 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,33 @@
 
 Pour expérimenter rapidement mkdocs avec le DSFR, vous pouvez cloner le [projet d'exemple](https://gitlab-forge.din.developpement-durable.gouv.fr/pub/numeco/mkdocs-dsfr-exemple).
 
+
+## Configuration du dépôt et des liens d'édition
+
+Dans le fichier `mkdocs.yml`, trois configurations importantes sont définies pour permettre aux utilisateurs de naviguer vers le dépôt source et d'éditer les pages directement :
+
+* `repo_url`: URL du dépôt Git où le code source de la documentation est hébergé.
+* `edit_uri`: Chemin relatif vers le dossier contenant les fichiers Markdown de la documentation dans le dépôt Git.
+* `edit_text`: Texte à afficher pour le lien d'édition.
+
+### Exemple de configuration
+
+Dans ce projet, les configurations sont définies comme suit :
+
+<pre><div class="bg-black rounded-md mb-4"><div class="flex items-center relative text-gray-200 bg-gray-800 px-4 py-2 text-xs font-sans justify-between rounded-t-md"><span>yaml</span><button class="flex ml-auto gap-2"><svg stroke="currentColor" fill="none" stroke-width="2" viewBox="0 0 24 24" stroke-linecap="round" stroke-linejoin="round" class="h-4 w-4" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"></path><rect x="8" y="2" width="8" height="4" rx="1" ry="1"></rect></svg>Copy code</button></div><div class="p-4 overflow-y-auto"><code class="!whitespace-pre hljs language-yaml">repo_url: https://gitlab-forge.din.developpement-durable.gouv.fr/pub/numeco/mkdocs-dsfr/
+edit_uri: blob/main/docs/
+edit_text: Éditer dans Gitlab Forge
+</code></div></div></pre>
+
+### Comment cela fonctionne
+
+* `repo_url` pointe vers le dépôt GitLab où se trouve le code source de la documentation.
+* `edit_uri` indique le chemin relatif vers les fichiers Markdown dans ce dépôt.
+* `edit_text` spécifie le texte qui sera affiché pour le lien d'édition.
+
+Si l'une de ces variables n'est pas remplie, le lien d'édition n'apparaîtra pas.
+
+
 ## Configuration du thème DSFR MkDocs
 
 Ce document décrit les différentes options de configuration pour le thème DSFR MkDocs.
diff --git a/dsfr/nav.html b/dsfr/nav.html
index 6d28a6b..021469c 100644
--- a/dsfr/nav.html
+++ b/dsfr/nav.html
@@ -21,9 +21,9 @@
 			{% endif %}
 		{% endfor %}
 	</ul>
-	{% if page.file %}
+	{% if page.file and config.repo_url and config.edit_uri %}
 	<a href="{{ config.repo_url }}{{ config.edit_uri }}{{ page.file.src_path }}" target="_blank" rel="noopener">
-		Éditer dans Gitlab Forge
+		{{ config.edit_text }}
 	</a>
 	{% endif %}
 
diff --git a/mkdocs.yml b/mkdocs.yml
index a1dbe0d..7725740 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -5,6 +5,7 @@ site_author: MkDocs Team
 
 repo_url: https://gitlab-forge.din.developpement-durable.gouv.fr/pub/numeco/mkdocs-dsfr/
 edit_uri: blob/main/docs/
+edit_text: Éditer dans Gitlab Forge
 
 
 theme:
-- 
GitLab