46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
{{- /*
|
|
Displays a list of internal links
|
|
|
|
@params pc Page context
|
|
@params sc Site context
|
|
*/
|
|
-}}
|
|
|
|
|
|
<!-- Variable assignment -->
|
|
|
|
{{- $params := . -}}
|
|
|
|
|
|
<!-- Validation -->
|
|
|
|
{{- if ( not ( isset $params "sc" ) ) -}}
|
|
{{- errorf "No site context received" -}}
|
|
{{- end -}}
|
|
|
|
{{- if ( not ( isset $params "pc" ) ) -}}
|
|
{{- errorf "No page context received (%q)" $params.sc.Page.File.Dir -}}
|
|
{{- end -}}
|
|
|
|
|
|
<!-- Rendering -->
|
|
|
|
<h3>Internal Links</h3>
|
|
<ul>
|
|
{{- range $params.pc.Params.internal_links -}}
|
|
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
|
|
{{ if ( isset . "name" ) }}
|
|
{{- errorf "Name is set (%q)" $params.sc.Page.File.Dir -}}
|
|
{{ end }}
|
|
{{- if ( isset . "src" ) -}}
|
|
{{- partial "single/main-body/links/link/page-resource-link.html" ( $params | merge ( dict "title" .title "src" .src ) ) }}
|
|
{{- else if ( isset . "ref" ) -}}
|
|
{{- partial "single/main-body/links/link/page-link.html" ( $params | merge ( dict "title" .title "ref" .ref ) ) }}
|
|
{{- else -}}
|
|
{{- partial "single/main-body/links/link/title-link.html" ( $params | merge ( dict "title" .title "link" .link ) ) }}
|
|
{{- end -}}
|
|
{{ else }}
|
|
{{- partial "single/main-body/links/link/basic-link.html" $params }}
|
|
{{ end }}
|
|
{{- end -}}
|
|
</ul>
|