git: df67e600e8 - main - Activate download pdf links for articles and books

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=df67e600e820b9f691bc94fc7c6c60fce8205405

commit df67e600e820b9f691bc94fc7c6c60fce8205405
Author:     Sergio Carlavilla Delgado <[email protected]>
AuthorDate: 2022-02-28 19:48:25 +0000
Commit:     Sergio Carlavilla Delgado <[email protected]>
CommitDate: 2022-02-28 19:48:25 +0000

    Activate download pdf links for articles and books
---
 documentation/config/_default/config.toml                 | 1 +
 documentation/themes/beastie/layouts/articles/list.html   | 7 +++++--
 documentation/themes/beastie/layouts/articles/single.html | 7 +++++--
 documentation/themes/beastie/layouts/books/list.html      | 5 ++++-
 documentation/themes/beastie/layouts/books/single.html    | 5 ++++-
 5 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/documentation/config/_default/config.toml b/documentation/config/_default/config.toml
index 17f8bb41dd..8795386966 100644
--- a/documentation/config/_default/config.toml
+++ b/documentation/config/_default/config.toml
@@ -18,6 +18,7 @@ googleAnalytics = 'UA-22767463-1'
   description = "FreeBSD Documentation Portal"
   isOnline = true
   editBaseUrl = "https://github.com/freebsd/freebsd-doc/edit/main/documentation/content/"
+  downloadBaseUrl = "https://download.freebsd.org/doc/"
 
 [security]
   enableInlineShortcodes = false
diff --git a/documentation/themes/beastie/layouts/articles/list.html b/documentation/themes/beastie/layouts/articles/list.html
index d79f13bb32..8719a9cc87 100644
--- a/documentation/themes/beastie/layouts/articles/list.html
+++ b/documentation/themes/beastie/layouts/articles/list.html
@@ -43,9 +43,12 @@
       <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $pathSections := split .Page.File "/" }}
+          {{ $path := printf "%s/%s/%s_%s.pdf" (index $pathSections 0) (index $pathSections 1) (index $pathSections 1) $.Site.Home.Language }}
+          {{ $pdfUrl := printf "%s%s/%s" $.Site.Params.downloadBaseUrl $.Site.Home.Language $path }}
+          <li><i class="fa fa-file-pdf-o" aria-hidden="true"></i><a href="{{ $pdfUrl }}">{{ i18n "download-pdf" }}</a></li>
           {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
-          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
+          <li><i class="fa fa-pencil-square-o" aria-hidden="true"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li>
         </ul>
       </div>
     </div>
diff --git a/documentation/themes/beastie/layouts/articles/single.html b/documentation/themes/beastie/layouts/articles/single.html
index d79f13bb32..8719a9cc87 100644
--- a/documentation/themes/beastie/layouts/articles/single.html
+++ b/documentation/themes/beastie/layouts/articles/single.html
@@ -43,9 +43,12 @@
       <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $pathSections := split .Page.File "/" }}
+          {{ $path := printf "%s/%s/%s_%s.pdf" (index $pathSections 0) (index $pathSections 1) (index $pathSections 1) $.Site.Home.Language }}
+          {{ $pdfUrl := printf "%s%s/%s" $.Site.Params.downloadBaseUrl $.Site.Home.Language $path }}
+          <li><i class="fa fa-file-pdf-o" aria-hidden="true"></i><a href="{{ $pdfUrl }}">{{ i18n "download-pdf" }}</a></li>
           {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
-          <li><a href="{{ $editUrl }}" target="_blank"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>{{ i18n "edit-page" }}</a></li>
+          <li><i class="fa fa-pencil-square-o" aria-hidden="true"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li>
         </ul>
       </div>
     </div>
diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index fc99508c90..95f282804d 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -122,7 +122,10 @@
       <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $pathSections := split .Page.File "/" }}
+          {{ $path := printf "%s/%s/%s_%s.pdf" (index $pathSections 0) (index $pathSections 1) (index $pathSections 1) $.Site.Home.Language }}
+          {{ $pdfUrl := printf "%s%s/%s" $.Site.Params.downloadBaseUrl $.Site.Home.Language $path }}
+          <li><i class="fa fa-file-pdf-o" aria-hidden="true"></i><a href="{{ $pdfUrl }}">{{ i18n "download-pdf" }}</a></li>
           {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
           <li><i class="fa fa-pencil-square-o" aria-hidden="true"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li>
         </ul>
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index fc99508c90..95f282804d 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -122,7 +122,10 @@
       <div class="resources">
         <h3>{{ i18n "resources" }}</h3>
         <ul class="contents">
-          <!--<li><a href="#"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>{{ i18n "download-pdf" }}</a></li>-->
+          {{ $pathSections := split .Page.File "/" }}
+          {{ $path := printf "%s/%s/%s_%s.pdf" (index $pathSections 0) (index $pathSections 1) (index $pathSections 1) $.Site.Home.Language }}
+          {{ $pdfUrl := printf "%s%s/%s" $.Site.Params.downloadBaseUrl $.Site.Home.Language $path }}
+          <li><i class="fa fa-file-pdf-o" aria-hidden="true"></i><a href="{{ $pdfUrl }}">{{ i18n "download-pdf" }}</a></li>
           {{ $editUrl := printf "%s%s/%s" $.Site.Params.editBaseUrl $.Site.Home.Language .Page.File }}
           <li><i class="fa fa-pencil-square-o" aria-hidden="true"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li>
         </ul>
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.