2 changed files with 25 additions and 0 deletions
@ -0,0 +1,7 @@ |
|||||
|
<!-- This shortcode renders an code block prefixed by a filename --> |
||||
|
<div class="highlightedFile"> |
||||
|
{{- with .Get 0 -}} |
||||
|
<div class="filename">{{ . | safeHTML }}</div> |
||||
|
{{- end -}} |
||||
|
{{- highlight (trim .Inner "\n") (.Get 1) (.Get 2) -}} |
||||
|
</div> |
||||
@ -0,0 +1,18 @@ |
|||||
|
<!-- This shortcode the HTML link to a localized resource --> |
||||
|
{{ $path := .Get "path" }} |
||||
|
{{ $lang := .Get "lang" }} |
||||
|
{{ $currentLang := .Page.Lang }} |
||||
|
{{ range .Page.Sites }} |
||||
|
{{ if eq .Language.Lang $lang }} |
||||
|
{{ with .GetPage $path }} |
||||
|
<a href="{{ .RelPermalink }}"> |
||||
|
{{ .Title }} |
||||
|
</a> |
||||
|
{{ if ne $currentLang $lang }} |
||||
|
{{- partial "icons/en.svg" . -}} |
||||
|
{{ end }} |
||||
|
{{ else }} |
||||
|
{{ errorf "shortcode internalLink: Cannot find page %q with lang %q" $path $lang }} |
||||
|
{{ end }} |
||||
|
{{ end }} |
||||
|
{{ end }} |
||||
Loading…
Reference in new issue