git: 352543bff3 - main - Add last modified to documentation and website

Sergio Carlavilla Delgado <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by carlavilla:

URL: https://cgit.FreeBSD.org/doc/commit/?id=352543bff308aed820f8fcf85c4dc3bde7a3f614

commit 352543bff308aed820f8fcf85c4dc3bde7a3f614
Author:     Sergio Carlavilla Delgado <[email protected]>
AuthorDate: 2022-03-25 20:44:24 +0000
Commit:     Sergio Carlavilla Delgado <[email protected]>
CommitDate: 2022-03-25 20:45:18 +0000

    Add last modified to documentation and website
    
    Add the last modified information to the articles and books
    in the Documentation Portal and in the website.
---
 documentation/config/_default/config.toml          |  1 +
 documentation/themes/beastie/i18n/en.toml          |  6 ++++++
 .../themes/beastie/layouts/articles/list.html      | 22 ++++++----------------
 .../themes/beastie/layouts/articles/single.html    | 22 ++++++----------------
 .../themes/beastie/layouts/books/list.html         |  7 ++++++-
 .../themes/beastie/layouts/books/single.html       |  7 ++++++-
 website/config/_default/config.toml                |  2 +-
 website/themes/beastie/i18n/en.toml                |  6 ++++++
 website/themes/beastie/layouts/_default/list.html  |  6 ++++++
 .../themes/beastie/layouts/_default/single.html    |  6 ++++++
 .../themes/beastie/layouts/commercial/list.html    |  6 ++++++
 .../themes/beastie/layouts/commercial/single.html  |  6 ++++++
 website/themes/beastie/layouts/events/list.html    |  6 ++++++
 website/themes/beastie/layouts/events/single.html  |  6 ++++++
 website/themes/beastie/layouts/news/list.html      |  6 ++++++
 website/themes/beastie/layouts/news/single.html    |  6 ++++++
 website/themes/beastie/layouts/press/list.html     |  6 ++++++
 website/themes/beastie/layouts/press/single.html   |  6 ++++++
 website/themes/beastie/layouts/security/list.html  |  6 ++++++
 .../themes/beastie/layouts/security/single.html    |  6 ++++++
 .../themes/beastie/layouts/usergroups/section.html |  7 ++++++-
 21 files changed, 116 insertions(+), 36 deletions(-)

diff --git a/documentation/config/_default/config.toml b/documentation/config/_default/config.toml
index 8667900012..087c0f5576 100644
--- a/documentation/config/_default/config.toml
+++ b/documentation/config/_default/config.toml
@@ -11,6 +11,7 @@ disableKinds = [ "taxonomy", "taxonomyTerm" ]
 authors = [ "[email protected]" ]
 ignoreFiles = [ "chapter.adoc$", "contrib-386bsd.adoc$", "contrib-additional.adoc$", "contrib-committers.adoc$", "contrib-corealumni.adoc$", "contrib-develalumni.adoc$", "contrib-develinmemoriam.adoc$", "contrib-portmgralumni.adoc$", "\\.po$" ]
 enableRobotsTXT = true
+enableGitInfo = true
 
 [params]
   websiteURL = "https://www.FreeBSD.org"
diff --git a/documentation/themes/beastie/i18n/en.toml b/documentation/themes/beastie/i18n/en.toml
index 64c466ad01..5cb974ed89 100644
--- a/documentation/themes/beastie/i18n/en.toml
+++ b/documentation/themes/beastie/i18n/en.toml
@@ -43,6 +43,12 @@ other = "Articles"
 [choose-language]
 other = "Choose language"
 
+[last-modified]
+other = "Last modified on"
+
+[by]
+other = "by"
+
 # ---------------------------------------------------
 # Header
 # ---------------------------------------------------
diff --git a/documentation/themes/beastie/layouts/articles/list.html b/documentation/themes/beastie/layouts/articles/list.html
index 8719a9cc87..e03ae61918 100644
--- a/documentation/themes/beastie/layouts/articles/list.html
+++ b/documentation/themes/beastie/layouts/articles/list.html
@@ -5,16 +5,6 @@
     {{ if .Params.subtitle }}
       <h3 class="subtitle">{{ .Params.subtitle }}</h3>
     {{ end }}
-    <div>
-      {{ $releaseInfo := split .Params.releaseinfo " " }}
-
-      {{if gt (len $releaseInfo) 3}}
-        {{ i18n "revision" }}:
-        <a href="https://cgit.freebsd.org/doc/commit/?id=">
-          <span class="gitref">{{ index $releaseInfo 2 }}</span>
-        </a>
-      {{ end }}
-    </div>
     {{ if .Params.copyright }}
       <div class="copyright">
         Copyright © {{ .Params.copyright }}
@@ -23,17 +13,17 @@
     {{ if isset .Params "trademarks" }}
       {{ partial "trademarks" .Params.trademarks }}
     {{ end }}
-    <div>
-      {{if gt (len $releaseInfo) 5}}
-        {{ $hour := replace (index $releaseInfo 4) "Z" "" }}
-        {{ i18n "last-modified" }} {{ index $releaseInfo 3 }} {{ $hour }} {{ i18n "by" }} {{ index $releaseInfo 5 }}.
-      {{ end }}
-    </div>
     <div class="toc-mobile">
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
     </div>
     {{ .Content }}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
   <aside class="toc">
     <div class="toc-content">
diff --git a/documentation/themes/beastie/layouts/articles/single.html b/documentation/themes/beastie/layouts/articles/single.html
index 8719a9cc87..e03ae61918 100644
--- a/documentation/themes/beastie/layouts/articles/single.html
+++ b/documentation/themes/beastie/layouts/articles/single.html
@@ -5,16 +5,6 @@
     {{ if .Params.subtitle }}
       <h3 class="subtitle">{{ .Params.subtitle }}</h3>
     {{ end }}
-    <div>
-      {{ $releaseInfo := split .Params.releaseinfo " " }}
-
-      {{if gt (len $releaseInfo) 3}}
-        {{ i18n "revision" }}:
-        <a href="https://cgit.freebsd.org/doc/commit/?id=">
-          <span class="gitref">{{ index $releaseInfo 2 }}</span>
-        </a>
-      {{ end }}
-    </div>
     {{ if .Params.copyright }}
       <div class="copyright">
         Copyright © {{ .Params.copyright }}
@@ -23,17 +13,17 @@
     {{ if isset .Params "trademarks" }}
       {{ partial "trademarks" .Params.trademarks }}
     {{ end }}
-    <div>
-      {{if gt (len $releaseInfo) 5}}
-        {{ $hour := replace (index $releaseInfo 4) "Z" "" }}
-        {{ i18n "last-modified" }} {{ index $releaseInfo 3 }} {{ $hour }} {{ i18n "by" }} {{ index $releaseInfo 5 }}.
-      {{ end }}
-    </div>
     <div class="toc-mobile">
       <h3>{{ i18n "toc" }}</h3>
       {{ .TableOfContents }}
     </div>
     {{ .Content }}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
   <aside class="toc">
     <div class="toc-content">
diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index 95f282804d..7a50dcf830 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -53,12 +53,17 @@
       <div>
         [ {{ i18n "split-html" }} / <a href="book/">{{ i18n "single-html" }}</a> ]
       </div>
-    {{ end }}
+      {{ end }}
     {{ end }}
     <div class="book-content">
       {{ .Content }}
     </div>
+    {{ if .GitInfo }}
     <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
     <div class="buttons">
       {{ if .Params.prev }}
       <div class="prev">
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index 95f282804d..7a50dcf830 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -53,12 +53,17 @@
       <div>
         [ {{ i18n "split-html" }} / <a href="book/">{{ i18n "single-html" }}</a> ]
       </div>
-    {{ end }}
+      {{ end }}
     {{ end }}
     <div class="book-content">
       {{ .Content }}
     </div>
+    {{ if .GitInfo }}
     <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
     <div class="buttons">
       {{ if .Params.prev }}
       <div class="prev">
diff --git a/website/config/_default/config.toml b/website/config/_default/config.toml
index 9bd9ecbd9d..3a9b767b11 100644
--- a/website/config/_default/config.toml
+++ b/website/config/_default/config.toml
@@ -12,7 +12,7 @@ disablePathToLower = true
 authors = [ "[email protected]" ]
 ignoreFiles = [ "\\.po$" ]
 enableRobotsTXT = true
-
+enableGitInfo = true
 preserveTOC = true
 
 [markup.asciidocExt]
diff --git a/website/themes/beastie/i18n/en.toml b/website/themes/beastie/i18n/en.toml
index 50ef8159b9..8767ae2140 100644
--- a/website/themes/beastie/i18n/en.toml
+++ b/website/themes/beastie/i18n/en.toml
@@ -17,6 +17,12 @@ other = "Download FreeBSD"
 [production]
 other = "Production"
 
+[last-modified]
+other = "Last modified on"
+
+[by]
+other = "by"
+
 # Header
 [donate]
 other = "Donate to FreeBSD"
diff --git a/website/themes/beastie/layouts/_default/list.html b/website/themes/beastie/layouts/_default/list.html
index 5e6bbd97a4..286e9ccd5e 100644
--- a/website/themes/beastie/layouts/_default/list.html
+++ b/website/themes/beastie/layouts/_default/list.html
@@ -8,6 +8,12 @@
   <div id="contentwrap">
     <h1>{{ .Title }}</h1>
     {{- .Content -}}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
 </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/_default/single.html b/website/themes/beastie/layouts/_default/single.html
index 5e6bbd97a4..286e9ccd5e 100644
--- a/website/themes/beastie/layouts/_default/single.html
+++ b/website/themes/beastie/layouts/_default/single.html
@@ -8,6 +8,12 @@
   <div id="contentwrap">
     <h1>{{ .Title }}</h1>
     {{- .Content -}}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
 </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/commercial/list.html b/website/themes/beastie/layouts/commercial/list.html
index 1449315e77..241b529958 100644
--- a/website/themes/beastie/layouts/commercial/list.html
+++ b/website/themes/beastie/layouts/commercial/list.html
@@ -27,6 +27,12 @@
       {{ if eq .Params.vendor "misc" }}
         {{ partial "commercial-misc.html" . }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/commercial/single.html b/website/themes/beastie/layouts/commercial/single.html
index 1449315e77..241b529958 100644
--- a/website/themes/beastie/layouts/commercial/single.html
+++ b/website/themes/beastie/layouts/commercial/single.html
@@ -27,6 +27,12 @@
       {{ if eq .Params.vendor "misc" }}
         {{ partial "commercial-misc.html" . }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/events/list.html b/website/themes/beastie/layouts/events/list.html
index 3af630914e..5d7ac526d6 100644
--- a/website/themes/beastie/layouts/events/list.html
+++ b/website/themes/beastie/layouts/events/list.html
@@ -253,6 +253,12 @@
           <a href="2003/">2003</a>
         </li>
       </ul>
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/events/single.html b/website/themes/beastie/layouts/events/single.html
index 3af630914e..5d7ac526d6 100644
--- a/website/themes/beastie/layouts/events/single.html
+++ b/website/themes/beastie/layouts/events/single.html
@@ -253,6 +253,12 @@
           <a href="2003/">2003</a>
         </li>
       </ul>
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/news/list.html b/website/themes/beastie/layouts/news/list.html
index d9e3ac3e42..a09ce25d88 100644
--- a/website/themes/beastie/layouts/news/list.html
+++ b/website/themes/beastie/layouts/news/list.html
@@ -73,6 +73,12 @@
           {{ end }}
         {{ end }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/news/single.html b/website/themes/beastie/layouts/news/single.html
index d9e3ac3e42..a09ce25d88 100644
--- a/website/themes/beastie/layouts/news/single.html
+++ b/website/themes/beastie/layouts/news/single.html
@@ -73,6 +73,12 @@
           {{ end }}
         {{ end }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/press/list.html b/website/themes/beastie/layouts/press/list.html
index 88c591492a..ee9fc61001 100644
--- a/website/themes/beastie/layouts/press/list.html
+++ b/website/themes/beastie/layouts/press/list.html
@@ -77,6 +77,12 @@
           {{ end }}
         {{ end }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/press/single.html b/website/themes/beastie/layouts/press/single.html
index 88c591492a..ee9fc61001 100644
--- a/website/themes/beastie/layouts/press/single.html
+++ b/website/themes/beastie/layouts/press/single.html
@@ -77,6 +77,12 @@
           {{ end }}
         {{ end }}
       {{ end }}
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/security/list.html b/website/themes/beastie/layouts/security/list.html
index fab09a2323..11f204d301 100644
--- a/website/themes/beastie/layouts/security/list.html
+++ b/website/themes/beastie/layouts/security/list.html
@@ -45,6 +45,12 @@
         </tbody>
       </table>
     {{ end }}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
 </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/security/single.html b/website/themes/beastie/layouts/security/single.html
index fab09a2323..11f204d301 100644
--- a/website/themes/beastie/layouts/security/single.html
+++ b/website/themes/beastie/layouts/security/single.html
@@ -45,6 +45,12 @@
         </tbody>
       </table>
     {{ end }}
+    {{ if .GitInfo }}
+    <hr />
+    <div class="last-modified">
+      <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+    </div>
+    {{ end }}
   </div>
 </div>
 {{ end }}
diff --git a/website/themes/beastie/layouts/usergroups/section.html b/website/themes/beastie/layouts/usergroups/section.html
index 49c48c10c5..2466fbb057 100644
--- a/website/themes/beastie/layouts/usergroups/section.html
+++ b/website/themes/beastie/layouts/usergroups/section.html
@@ -156,7 +156,12 @@
         {{ end }}
         </dl>
       {{ end }}
-
+      {{ if .GitInfo }}
+      <hr />
+      <div class="last-modified">
+        <p><strong>{{ i18n "last-modified" }}</strong>: {{ .GitInfo.AuthorDate | time.Format ":date_long" }} {{ i18n "by" }} <a href="https://cgit.freebsd.org/doc/commit/?id={{ .GitInfo.AbbreviatedHash }}" target="_blank">{{ .GitInfo.AuthorName }}</a></p>
+      </div>
+      {{ end }}
     </div>
   </div>
 {{ end }}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.