Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lister les customisations apportées au thème #12

Open
thbar opened this issue May 15, 2023 · 2 comments
Open

Lister les customisations apportées au thème #12

thbar opened this issue May 15, 2023 · 2 comments
Assignees

Comments

@thbar
Copy link
Contributor

thbar commented May 15, 2023

Vu avec @fchabouis, le thème a été en fait customisé. Du coup une upgrade du theme (#11) peut casser, ou peut nécessiter un backport des changements.

Je vais générer un patch pour noter tout ça.

@thbar thbar self-assigned this May 15, 2023
@thbar
Copy link
Contributor Author

thbar commented May 15, 2023

Ce que j'ai fait:

  • récupération du thème Hugo au commit 8021be2 qui est utilisé ici (clone)
  • copie des fichiers de notre repo "layout" vers le clone ci-dessus
  • suppression des effacements (puisqu'ils n'overrident pas) avec git status | grep deleted | cut -d':' -f2 | xargs git restore
  • comparaison avec git diff --ignore-all-space

J'obtiens ceci:

diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 355697e..52d185e 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -27,7 +27,7 @@
   {{- end }}
 
   {{- if .Content }}
-  <div class="post-content">
+  <div class="post-content {{- if .Param "autonumbering" }} autonumbering {{- end }}">
     {{- if not (.Param "disableAnchoredHeadings") }}
     {{- partial "anchored_headings.html" .Content -}}
     {{- else }}{{ .Content }}{{ end }}
@@ -35,6 +35,10 @@
   {{- end }}
 
   <footer class="post-footer">
+    {{- if (.Param "applause") }}
+    {{- partial "applause.html" . }}
+    {{- end }}
+    
     {{- if .Params.tags }}
     <ul class="post-tags">
       {{- range ($.GetTerms "tags") }}
@@ -49,7 +53,6 @@
     {{- partial "share_icons.html" . -}}
     {{- end }}
   </footer>
-
   {{- if (.Param "comments") }}
   {{- partial "comments.html" . }}
   {{- end }}
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index 918451a..c09b119 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -1,3 +1,5 @@
 {{- /* Comments area start */ -}}
-{{- /* to add comments read => https://gohugo.io/content-management/comments/ */ -}}
+<script src="https://utteranc.es/client.js" repo="etalab/transport-normes" issue-term="pathname" label="Comment"
+    theme="github-light" crossorigin="anonymous" async>
+    </script>
 {{- /* Comments area end */ -}}
diff --git a/layouts/partials/edit_post.html b/layouts/partials/edit_post.html
index 1d90ebd..7bdd900 100644
--- a/layouts/partials/edit_post.html
+++ b/layouts/partials/edit_post.html
@@ -1,5 +1,8 @@
 {{- if or .Params.editPost.URL .Site.Params.editPost.URL -}}
 {{- $fileUrlPath := path.Join .File.Path }}
+<!-- remove manually normes/ from path, as the content lives in a different repository than the site code -->
+{{- $fileUrlPath := strings.Replace  $fileUrlPath "normes/"  "" }}
+
 
 {{- if or .Params.author $.Site.Params.author (.Param "ShowReadingTime") (not .Date.IsZero) .IsTranslated }}&nbsp;|&nbsp;{{- end -}}
 <a href="{{ .Params.editPost.URL | default .Site.Params.editPost.URL }}{{ if .Params.editPost.appendFilePath | default ( .Site.Params.editPost.appendFilePath | default false ) }}/{{ $fileUrlPath }}{{ end }}" rel="noopener noreferrer" target="_blank">
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 8750e9b..7d3cd9a 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -38,13 +38,15 @@
 
 </script>
 {{- end }}
+
+{{ partial "matomo.html" . }}
+
 <noscript>
   <style type="text/css">
     #theme-toggle,
     .top-link {
       display: none;
     }
-
   </style>
   {{- if (and (ne .Site.Params.defaultTheme "light") (ne .Site.Params.defaultTheme "dark")) }}
   <style>
@@ -73,7 +75,6 @@
         border-color: var(--theme);
       }
     }
-
   </style>
   {{- end }}
 </noscript>
@@ -85,23 +86,18 @@
       {{- if .Site.Title }}
       <a href="{{ "" | absLangURL }}" accesskey="h" title="{{ $label_text }} (Alt + H)">
         {{- if .Site.Params.label.icon }}
-                <img src="{{- .Site.Params.label.icon -}}" alt="logo" aria-label="logo"
-                    height="{{- .Site.Params.label.iconHeight | default " 30px" -}}">
+        <img src="{{- .Site.Params.label.icon -}}" alt="logo" aria-label="logo" height="{{- .Site.Params.label.iconHeight | default " 30px" -}}">
         {{- end -}}
-                {{- $label_text -}}
+        <!-- {{- $label_text -}} -->
       </a>
       {{- end }}
       <span class="logo-switches">
         {{- if (not .Site.Params.disableThemeToggle) }}
         <button id="theme-toggle" accesskey="t" title="(Alt + T)">
-                    <svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
-                        fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
-                        stroke-linejoin="round">
+          <svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
             <path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
           </svg>
-                    <svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
-                        fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"
-                        stroke-linejoin="round">
+          <svg id="sun" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
             <circle cx="12" cy="12" r="5"></circle>
             <line x1="12" y1="1" x2="12" y2="3"></line>
             <line x1="12" y1="21" x2="12" y2="23"></line>
@@ -119,12 +115,12 @@
         {{- $separator := or $label_text (not .Site.Params.disableThemeToggle)}}
         {{- with $.Site.Home.AllTranslations }}
         <ul class="lang-switch">
-                    {{- if $separator }}<li>|</li>{{ end }}
+          {{- if $separator }}
+          <li>|</li>{{ end }}
           {{- range . -}}
           {{- if ne $lang .Lang }}
           <li>
-                        <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}"
-                            aria-label="{{ .Language.LanguageName | default (.Lang | title) }}">
+            <a href="{{- .Permalink -}}" title="{{ .Language.Params.languageAltTitle | default (.Language.LanguageName | emojify) | default (.Lang | title) }}" aria-label="{{ .Language.LanguageName | default (.Lang | title) }}">
               {{- if (and $.Site.Params.displayFullLangName (.Language.LanguageName)) }}
               {{- .Language.LanguageName | emojify -}}
               {{- else }}
@@ -145,8 +141,7 @@
       {{- $page_url:= $currentPage.Permalink | absLangURL }}
       {{- $is_search := eq ($.Site.GetPage .KeyName).Layout `search` }}
       <li>
-                <a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}"
-                {{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
+        <a href="{{ .URL | absLangURL }}" title="{{ .Title | default .Name }} {{- cond $is_search (" (Alt + /)" | safeHTMLAttr) ("" | safeHTMLAttr ) }}" {{- cond $is_search (" accesskey=/" | safeHTMLAttr) ("" | safeHTMLAttr ) }}>
           <span {{- if eq $menu_item_url $page_url }} class="active" {{- end }}>
             {{- .Pre }}
             {{- .Name -}}
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
index 7a4c019..705e2fe 100644
--- a/layouts/partials/toc.html
+++ b/layouts/partials/toc.html
@@ -1,7 +1,7 @@
 {{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}}
 {{- $has_headers := ge (len $headers) 1 -}}
 {{- if $has_headers -}}
-<div class="toc">
+<div class="toc {{- if .Param "autonumbering" }} autonumbering {{- end }}">
     <details {{if (.Param "TocOpen") }} open{{ end }}>
         <summary accesskey="c" title="(Alt + C)">
             <span class="details">{{- i18n "toc" | default "Table of Contents" }}</span>

@fchabouis est-ce que tu retrouves à peu près ce que tu as fait à l'époque ? Merci !

Pas besoin forcément de tout mettre à jour là mais déjà comprendre ce qui était changé.

@fchabouis
Copy link
Contributor

oui ça me parait correspondre, il n'y avait pas tant de customisation que ça (ouf)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants