mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-09-02 19:52:40 +00:00
♻️ Refactor: migrate params.gitRepo and params.page.edit to params.gitInfo
and add page params: `linkToSource`, `linkToEdit` and `linkToReport`
This commit is contained in:
+1
-1
Submodule docs updated: 95fde1f07d...b317055f0a
@@ -95,8 +95,6 @@ enableEmoji = true
|
||||
keywords = ["Hugo", "FixIt"]
|
||||
# site default theme ["light", "dark", "auto"]
|
||||
defaultTheme = "auto"
|
||||
# public git repo url only then enableGitInfo is true
|
||||
gitRepo = ""
|
||||
# FixIt 0.1.1 | NEW which hash function used for SRI, when empty, no SRI is used
|
||||
# ["sha256", "sha384", "sha512", "md5"]
|
||||
fingerprint = ""
|
||||
@@ -119,6 +117,17 @@ enableEmoji = true
|
||||
link = ""
|
||||
avatar = ""
|
||||
|
||||
# FixIt 0.3.0 | NEW public Git repository information only then enableGitInfo is true
|
||||
[params.gitInfo]
|
||||
# e.g. "https://github.com/hugo-fixit/docs"
|
||||
repo = ""
|
||||
branch = "main"
|
||||
# the content directory path relative to the root of the repository
|
||||
dir = "content"
|
||||
# the issue template for reporting issue of the posts
|
||||
# available template params: {title} {URL} {sourceURL}
|
||||
issueTpl = "title=[BUG]%20{title}&body=|Field|Value|%0A|-|-|%0A|Title|{title}|%0A|URL|{URL}|%0A|Filename|{sourceURL}|"
|
||||
|
||||
# FixIt 0.2.0 | NEW App icon config
|
||||
[params.app]
|
||||
# optional site title override for the app when added to an iOS home screen or Android launcher
|
||||
@@ -413,8 +422,14 @@ enableEmoji = true
|
||||
fontawesome = true
|
||||
# license info (HTML format is supported)
|
||||
license = '<a rel="license external nofollow noopener noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a>'
|
||||
# whether to show link to Raw Markdown content of the content
|
||||
# whether to show link to Raw Markdown content of the post
|
||||
linkToMarkdown = true
|
||||
# FixIt 0.3.0 | NEW whether to show link to view source code of the post
|
||||
linkToSource = true
|
||||
# FixIt 0.3.0 | NEW whether to show link to edit the post
|
||||
linkToEdit = true
|
||||
# FixIt 0.3.0 | NEW whether to show link to report issue for the post
|
||||
linkToReport = true
|
||||
# FixIt 0.2.4 | NEW whether to show the full text content in RSS
|
||||
rssFullText = false
|
||||
# FixIt 0.2.13 | NEW Page style ["narrow", "normal", "wide", ...]
|
||||
@@ -479,13 +494,6 @@ enableEmoji = true
|
||||
edit = true
|
||||
# the maximum number of lines of displayed code by default
|
||||
maxShownLines = 10
|
||||
# FixIt 0.2.14 | NEW Post edit
|
||||
[params.page.edit]
|
||||
enable = false
|
||||
# FixIt 0.2.15 | CHANGED Link for fork & edit
|
||||
# url = "/edit/branch-name/subdirectory-name" # base on `params.gitRepo`
|
||||
# url = "https://github.com/user-name/repo-name/edit/branch-name/subdirectory-name" # full url
|
||||
url = ""
|
||||
# FixIt 0.2.0 | NEW Mapbox GL JS config (https://docs.mapbox.com/mapbox-gl-js)
|
||||
[params.page.mapbox]
|
||||
# access token of Mapbox GL JS
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "Kommentare"
|
||||
author = "Autor"
|
||||
updatedOnDate = "Aktualisiert am {{ .Date }}"
|
||||
readMarkdown = "Markdown anzeigen"
|
||||
viewSource = ""
|
||||
editThisPage = "Diese Seite bearbeiten"
|
||||
reportIssue = ""
|
||||
back = "Zurück"
|
||||
home = "Startseite"
|
||||
readMore = "Mehr lesen"
|
||||
|
||||
@@ -110,7 +110,9 @@ comments = "comments"
|
||||
author = "Author"
|
||||
updatedOnDate = "Updated on {{ .Date }}"
|
||||
readMarkdown = "Read Markdown"
|
||||
viewSource = "View source"
|
||||
editThisPage = "Edit this page"
|
||||
reportIssue = "Report issue"
|
||||
back = "Back"
|
||||
home = "Home"
|
||||
readMore = "Read More"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "Comentarios"
|
||||
author = "Autor"
|
||||
updatedOnDate = "Actualizado el {{ .Date }}"
|
||||
readMarkdown = "Leer Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = ""
|
||||
back = "Regresar"
|
||||
home = "Inicio"
|
||||
readMore = "Leer más"
|
||||
|
||||
@@ -110,7 +110,9 @@ comments = "commentaires"
|
||||
author = "Auteur"
|
||||
updatedOnDate = "Mis à jour le {{ .Date }}"
|
||||
readMarkdown = "Ouvrir le Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Modifier cette page"
|
||||
reportIssue = ""
|
||||
back = "Retour"
|
||||
home = "Accueil"
|
||||
readMore = "En savoir plus"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "commenti"
|
||||
author = "Autore"
|
||||
updatedOnDate = "Aggiornato il {{ .Date }}"
|
||||
readMarkdown = "Leggi Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Modifica questa pagina"
|
||||
reportIssue = ""
|
||||
back = "Indietro"
|
||||
home = "Home"
|
||||
readMore = "Leggi di più"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "komentarzy"
|
||||
author = "Autor"
|
||||
updatedOnDate = "Zaktualizowano {{ .Date }}"
|
||||
readMarkdown = "Zobacz Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Edytuj tą stronę"
|
||||
reportIssue = ""
|
||||
back = "Wstecz"
|
||||
home = "Strona główna"
|
||||
readMore = "Czytaj więcej"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "comentários"
|
||||
author = "Autor"
|
||||
updatedOnDate = "Atualizado em {{ .Date }}"
|
||||
readMarkdown = "Leia em Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Editar esta página"
|
||||
reportIssue = ""
|
||||
back = "Voltar"
|
||||
home = "Home"
|
||||
readMore = "Leia mais"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "comentarii"
|
||||
author = "Autor"
|
||||
updatedOnDate = "Actualizat la {{ .Date }}"
|
||||
readMarkdown = "Citire Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Editați această pagină"
|
||||
reportIssue = ""
|
||||
back = "Înapoi"
|
||||
home = "Acasă"
|
||||
readMore = "Citește mai mult"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "комментариев"
|
||||
author = "Автор"
|
||||
updatedOnDate = "Oбновлена {{ .Date }}"
|
||||
readMarkdown = "Читать Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Редактировать эту страницу"
|
||||
reportIssue = ""
|
||||
back = "Назад"
|
||||
home = "Домой"
|
||||
readMore = "Читать больше"
|
||||
|
||||
@@ -111,7 +111,9 @@ comments = "коментари"
|
||||
author = "Аутор"
|
||||
updatedOnDate = "Ажурирано {{ .Date }}"
|
||||
readMarkdown = "Читај Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Уреди ову страницу"
|
||||
reportIssue = ""
|
||||
back = "Назад"
|
||||
home = "Почетна"
|
||||
readMore = "Прочитај више"
|
||||
|
||||
@@ -110,7 +110,9 @@ comments = "bình luận"
|
||||
author = "Tác giả"
|
||||
updatedOnDate = "Cập nhật ngày {{ .Date }}"
|
||||
readMarkdown = "Đọc với định dạng Markdown"
|
||||
viewSource = ""
|
||||
editThisPage = "Chỉnh sửa trang này"
|
||||
reportIssue = ""
|
||||
back = "Quay lại"
|
||||
home = "Trang chủ"
|
||||
readMore = "Đọc thêm"
|
||||
|
||||
@@ -109,7 +109,9 @@ comments = "条评论"
|
||||
author = "作者"
|
||||
updatedOnDate = "更新于 {{ .Date }}"
|
||||
readMarkdown = "阅读原始文档"
|
||||
viewSource = "查看源码"
|
||||
editThisPage = "编辑此页"
|
||||
reportIssue = "报告问题"
|
||||
back = "返回"
|
||||
home = "主页"
|
||||
readMore = "阅读全文"
|
||||
|
||||
@@ -109,7 +109,9 @@ comments = "條評論"
|
||||
author = "作者"
|
||||
updatedOnDate = "更新於 {{ .Date }}"
|
||||
readMarkdown = "閱讀原始文檔"
|
||||
viewSource = "查看原始碼"
|
||||
editThisPage = "編輯此頁"
|
||||
reportIssue = "報告問題"
|
||||
back = "返回"
|
||||
home = "主頁"
|
||||
readMore = "閱讀全文"
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
{{- $warns = $warns | append "The parameter `footer.siteTime` has changed to a Map since v0.2.17. Please correct the format!" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Site.Params.gitRepo | or .Site.Params.page.edit -}}
|
||||
{{- $warns = $warns | append "The parameter `params.gitRepo` and `params.page.edit` is deprecated since v0.3.0, use `params.gitInfo` instead." -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if len $warns -}}
|
||||
{{- warnf "Deprecated parameter detection until %v\n - %v\n\n" (.Scratch.Get "version") (delimit $warns "\n - ") -}}
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
{{- $gitRepo := (strings.TrimSuffix "/" .Site.Params.gitRepo) -}}
|
||||
|
||||
{{- /* Git info */ -}}
|
||||
{{- $gitRepo := "" -}}
|
||||
{{- $blobURL := "" -}}
|
||||
{{- $sourceURL := "" -}}
|
||||
{{- $editURL := "" -}}
|
||||
{{- $reportURL := "" -}}
|
||||
{{- with .Site.Params.gitInfo -}}
|
||||
{{- if .Repo -}}
|
||||
{{- $gitRepo = strings.TrimSuffix "/" .Repo -}}
|
||||
{{- $blobURL = printf "%v/blob/%v/%v/{path}" $gitRepo .Branch .Dir -}}
|
||||
{{- $editURL = printf "%v/edit/%v/%v/{path}" $gitRepo .Branch .Dir -}}
|
||||
{{- $reportURL = printf "%v/issues/new?%v" $gitRepo .IssueTpl -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<div class="post-footer" id="post-footer">
|
||||
<div class="post-info">
|
||||
@@ -27,25 +41,33 @@
|
||||
</div>
|
||||
<div class="post-info-line{{ with $params.password }} d-none{{ end }}">
|
||||
<div class="post-info-md">
|
||||
{{- if $params.linktomarkdown -}}
|
||||
{{- $linkOptions := slice -}}
|
||||
{{- if $params.LinkToMarkdown -}}
|
||||
{{- with .OutputFormats.Get "markdown" -}}
|
||||
<span>
|
||||
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") "externalIcon" false -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
{{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") "externalIcon" false -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with $params.edit -}}
|
||||
{{- if .Enable -}}
|
||||
<span>
|
||||
{{- $editUrl := printf "%v/%v" (strings.TrimSuffix "/" .Url) $.File.Path -}}
|
||||
{{- if not (hasPrefix $editUrl "http") -}}
|
||||
{{- $editUrl = printf "%v/%v" $gitRepo (strings.TrimPrefix "/" $editUrl) -}}
|
||||
{{- end -}}
|
||||
{{- $options := dict "Class" "link-to-edit" "Destination" $editUrl "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
|
||||
{{- partial "plugin/link.html" $options -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToSource | and $gitRepo -}}
|
||||
{{- $link := replace $blobURL "{path}" $.File.Path -}}
|
||||
{{- $sourceURL = add $link "?plain=1" -}}
|
||||
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") "externalIcon" false -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToEdit | and $gitRepo -}}
|
||||
{{- $link := replace $editURL "{path}" $.File.Path -}}
|
||||
{{- $options := dict "Class" "link-to-edit" "Destination" $link "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- if $params.LinkToReport | and $gitRepo -}}
|
||||
{{- $link := replace $reportURL "{title}" ($.Title | urlquery) -}}
|
||||
{{- $link = replace $link "{URL}" $.Permalink -}}
|
||||
{{- $link = replace $link "{sourceURL}" $sourceURL -}}
|
||||
{{- $options := dict "Class" "link-to-report" "Destination" $link "Title" (T "single.reportIssue") "Content" (T "single.reportIssue") "externalIcon" false -}}
|
||||
{{- $linkOptions = $linkOptions | append $options -}}
|
||||
{{- end -}}
|
||||
{{- range $linkOptions -}}
|
||||
<span>{{ partial "plugin/link.html" . }}</span>
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-info-share">
|
||||
|
||||
Reference in New Issue
Block a user