{{- /* Git info */ -}} {{- $gitRepo := "" -}} {{- $blobURL := "" -}} {{- $sourceURL := "" -}} {{- $editURL := "" -}} {{- $reportURL := "" -}} {{- with .Site.Params.git_info -}} {{- 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 .issue_tpl -}} {{- end -}} {{- end -}} {{- $linkOptions := slice -}} {{- $postLink := .Param "post_link" | default dict -}} {{- if not .Params.password -}} {{- if $postLink.markdown -}} {{- with .OutputFormats.Get "markdown" -}} {{- $options := dict "Class" "link-to-markdown" "Destination" .RelPermalink "Title" (T "single.readMarkdown") "Content" (T "single.readMarkdown") -}} {{- $linkOptions = $linkOptions | append $options -}} {{- end -}} {{- end -}} {{- if $postLink.source | and $gitRepo -}} {{- $link := replace $blobURL "{path}" $.File.Path -}} {{- $sourceURL = .Param "source_url" | default (add $link "?plain=1") -}} {{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") -}} {{- $linkOptions = $linkOptions | append $options -}} {{- end -}} {{- if $postLink.edit | and $gitRepo -}} {{- $link := replace $editURL "{path}" $.File.Path -}} {{- $editURL = .Param "edit_url" | default $link -}} {{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") -}} {{- $linkOptions = $linkOptions | append $options -}} {{- end -}} {{- if $postLink.report | 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") -}} {{- $linkOptions = $linkOptions | append $options -}} {{- end -}} {{- end -}} {{- with $postLink.editor -}} {{- if hugo.IsServer | and (not $.File.IsContentAdapter) -}} {{- $link := printf "%s://file/%v" . $.File.Filename -}} {{- $options := dict "Class" "link-to-editor" "Destination" $link "Title" (T "single.openInEditor") "Content" (T "single.openInEditor") -}} {{- $linkOptions = $linkOptions | append $options -}} {{- end -}} {{- end -}}