git: a39610b552 - main - Documentation - Theme: Fix edit button
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Jan 2025 09:50:05 UTC
The branch main has been updated by carlavilla:
URL: https://cgit.FreeBSD.org/doc/commit/?id=a39610b552a0d7f970acbef698c027d83033d8b4
commit a39610b552a0d7f970acbef698c027d83033d8b4
Author: Daniel Cunha <danielsoro@gmail.com>
AuthorDate: 2025-01-18 09:49:17 +0000
Commit: Sergio Carlavilla Delgado <carlavilla@FreeBSD.org>
CommitDate: 2025-01-18 09:49:17 +0000
Documentation - Theme: Fix edit button
Approved by: carlavilla@
Pull Request: https://github.com/freebsd/freebsd-doc/pull/396
---
documentation/themes/beastie/layouts/articles/list.html | 3 ++-
documentation/themes/beastie/layouts/books/list.html | 12 ++++++++++--
documentation/themes/beastie/layouts/books/single.html | 3 ++-
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/documentation/themes/beastie/layouts/articles/list.html b/documentation/themes/beastie/layouts/articles/list.html
index 14120e6b90..5c3029352f 100644
--- a/documentation/themes/beastie/layouts/articles/list.html
+++ b/documentation/themes/beastie/layouts/articles/list.html
@@ -47,9 +47,10 @@
{{ $docType := index $pathSections 1 }}
{{ $docName := index $pathSections 2 }}
{{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }}
+ {{ $adocFileName := printf "%s.adoc" $.Page.File }}
{{ $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 }}
+ {{ $editUrl := printf "%s%s/%s/%s/%s" $.Site.Params.editBaseUrl $docLang $docType $docName $adocFileName }}
<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>
</ul>
</div>
diff --git a/documentation/themes/beastie/layouts/books/list.html b/documentation/themes/beastie/layouts/books/list.html
index ccc0152d0b..dc6a7f63e5 100644
--- a/documentation/themes/beastie/layouts/books/list.html
+++ b/documentation/themes/beastie/layouts/books/list.html
@@ -133,11 +133,19 @@
{{ $docLang := $.Site.Home.Language.Lang }}
{{ $docType := index $pathSections 1 }}
{{ $docName := index $pathSections 2 }}
+ {{ $sectionName := index $pathSections 3 }}
{{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }}
+ {{ $adocFileName := printf "%s.adoc" $.Page.File }}
{{ $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>
+ {{ if $sectionName }}
+ {{ $editUrl := printf "%s%s/%s/%s/%s/%s" $.Site.Params.editBaseUrl $docLang $docType $docName $sectionName $adocFileName }}
+ <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>
+ {{ else }}
+ {{ $editUrl := printf "%s%s/%s/%s/%s" $.Site.Params.editBaseUrl $docLang $docType $docName $adocFileName }}
+ <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>
+ {{ end }}
+
</ul>
</div>
</div>
diff --git a/documentation/themes/beastie/layouts/books/single.html b/documentation/themes/beastie/layouts/books/single.html
index ccc0152d0b..332b00d4d7 100644
--- a/documentation/themes/beastie/layouts/books/single.html
+++ b/documentation/themes/beastie/layouts/books/single.html
@@ -134,9 +134,10 @@
{{ $docType := index $pathSections 1 }}
{{ $docName := index $pathSections 2 }}
{{ $pdfFilename := printf "%s_%s.pdf" $docName $docLang }}
+ {{ $adocFileName := printf "%s.adoc" $.Page.File }}
{{ $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 }}
+ {{ $editUrl := printf "%s%s/%s/%s/%s" $.Site.Params.editBaseUrl $docLang $docType $docName $adocFileName }}
<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>
</ul>
</div>