mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
10 hours ago c70b22c0c65d21fc25eda46a8182eb042da11da0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{{- /*
  edit-page shortcode
 
  Renders a link to edit the current page's source file on GitHub. Visitors
  without write access to the repository are automatically offered GitHub's
  standard "fork and propose changes" flow when they follow the link.
 
  The branch can be overridden per call:
    - positional:  {{< edit-page "development" >}}
    - named:       {{< edit-page branch="development" >}}
 
  All other settings are read from site configuration. See the shared
  `edit-page.html` partial for the full list of configuration options under
  params.ananke.shortcodes.edit_page.
*/ -}}
{{- $branch := "" -}}
{{- if .IsNamedParams -}}
  {{- with .Get "branch" }}{{ $branch = . }}{{ end -}}
{{- else -}}
  {{- with .Get 0 }}{{ $branch = . }}{{ end -}}
{{- end -}}
{{- with .Page.File -}}
  {{- partials.Include "edit-page.html" (dict "page" $.Page "branch" $branch) -}}
{{- else -}}
  {{- warnf "[ananke] the 'edit-page' shortcode was used on a page without a source file (%q)" $.Page.Title -}}
{{- end -}}