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

Patrick Kollitsch
4 days ago 1832a681026ac3db6e62aa90cb5ed75886ea69ac
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 -}}