Documentation - Theme: Fix edit button

Approved by:	carlavilla@
Pull Request:	https://github.com/freebsd/freebsd-doc/pull/396
This commit is contained in:
Daniel Cunha 2025-01-18 10:49:17 +01:00 committed by Sergio Carlavilla Delgado
parent 8f7c6e897a
commit a39610b552
3 changed files with 14 additions and 4 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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>