git: f8c0dc03a7 - main - documentation/themes: Fix the Download PDF link after Hugo upgrade
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 29 Jun 2024 14:51:32 UTC
The branch main has been updated by dbaio: URL: https://cgit.FreeBSD.org/doc/commit/?id=f8c0dc03a753351c921c2b37d45526ab08d58b83 commit f8c0dc03a753351c921c2b37d45526ab08d58b83 Author: Danilo G. Baio <dbaio@FreeBSD.org> AuthorDate: 2024-06-29 13:57:59 +0000 Commit: Danilo G. Baio <dbaio@FreeBSD.org> CommitDate: 2024-06-29 13:57:59 +0000 documentation/themes: Fix the Download PDF link after Hugo upgrade PR: 279896 Reported by: freebsd.illusive064@passinbox.com --- documentation/themes/beastie/layouts/articles/list.html | 9 ++++++--- documentation/themes/beastie/layouts/articles/single.html | 9 ++++++--- documentation/themes/beastie/layouts/books/list.html | 9 ++++++--- documentation/themes/beastie/layouts/books/single.html | 9 ++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/documentation/themes/beastie/layouts/articles/list.html b/documentation/themes/beastie/layouts/articles/list.html index deecb60507..14120e6b90 100644 --- a/documentation/themes/beastie/layouts/articles/list.html +++ b/documentation/themes/beastie/layouts/articles/list.html @@ -42,9 +42,12 @@ <div class="resources"> <h3>{{ i18n "resources" }}</h3> <ul class="contents"> - {{ $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 }} + {{ $pathSections := split .Page.Path "/" }} + {{ $docLang := $.Site.Home.Language.Lang }} + {{ $docType := index $pathSections 1 }} + {{ $docName := index $pathSections 2 }} + {{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }} + {{ $pdfUrl := printf "%s%s/%s/%s/%s" $.Site.Params.downloadBaseUrl $docLang $docType $docName $pdfFilename }} <li><i class="fa fa-file-pdf-o" aria-hidden="true" title="{{ i18n "download-pdf" }}"></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" title="{{ i18n "edit-page" }}"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li> diff --git a/documentation/themes/beastie/layouts/articles/single.html b/documentation/themes/beastie/layouts/articles/single.html index deecb60507..14120e6b90 100644 --- a/documentation/themes/beastie/layouts/articles/single.html +++ b/documentation/themes/beastie/layouts/articles/single.html @@ -42,9 +42,12 @@ <div class="resources"> <h3>{{ i18n "resources" }}</h3> <ul class="contents"> - {{ $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 }} + {{ $pathSections := split .Page.Path "/" }} + {{ $docLang := $.Site.Home.Language.Lang }} + {{ $docType := index $pathSections 1 }} + {{ $docName := index $pathSections 2 }} + {{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }} + {{ $pdfUrl := printf "%s%s/%s/%s/%s" $.Site.Params.downloadBaseUrl $docLang $docType $docName $pdfFilename }} <li><i class="fa fa-file-pdf-o" aria-hidden="true" title="{{ i18n "download-pdf" }}"></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" title="{{ i18n "edit-page" }}"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li> diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html index 2668a3de8a..08672d3097 100644 --- a/documentation/themes/beastie/layouts/books/list.html +++ b/documentation/themes/beastie/layouts/books/list.html @@ -129,9 +129,12 @@ <div class="resources"> <h3>{{ i18n "resources" }}</h3> <ul class="contents"> - {{ $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 }} + {{ $pathSections := split .Page.Path "/" }} + {{ $docLang := $.Site.Home.Language.Lang }} + {{ $docType := index $pathSections 1 }} + {{ $docName := index $pathSections 2 }} + {{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }} + {{ $pdfUrl := printf "%s%s/%s/%s/%s" $.Site.Params.downloadBaseUrl $docLang $docType $docName $pdfFilename }} <li><i class="fa fa-file-pdf-o" aria-hidden="true" title="{{ i18n "download-pdf" }}"></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" title="{{ i18n "edit-page" }}"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li> diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html index 2668a3de8a..08672d3097 100644 --- a/documentation/themes/beastie/layouts/books/single.html +++ b/documentation/themes/beastie/layouts/books/single.html @@ -129,9 +129,12 @@ <div class="resources"> <h3>{{ i18n "resources" }}</h3> <ul class="contents"> - {{ $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 }} + {{ $pathSections := split .Page.Path "/" }} + {{ $docLang := $.Site.Home.Language.Lang }} + {{ $docType := index $pathSections 1 }} + {{ $docName := index $pathSections 2 }} + {{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }} + {{ $pdfUrl := printf "%s%s/%s/%s/%s" $.Site.Params.downloadBaseUrl $docLang $docType $docName $pdfFilename }} <li><i class="fa fa-file-pdf-o" aria-hidden="true" title="{{ i18n "download-pdf" }}"></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" title="{{ i18n "edit-page" }}"></i><a href="{{ $editUrl }}" target="_blank">{{ i18n "edit-page" }}</a></li>