Update for new Hugo versions
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
9
layouts/_markup/render-blockquote.html
Normal file
9
layouts/_markup/render-blockquote.html
Normal file
@@ -0,0 +1,9 @@
|
||||
{{ if and (eq .Type "alert") (eq .AlertType "todo") -}}
|
||||
<div style="background-color: tomato; color: white; padding: 10px;">
|
||||
<em>TODO: </em>{{- .Text | plainify -}}
|
||||
</div>
|
||||
{{- else -}}
|
||||
<blockquote {{- with .Attributes.id }} id="{{ . }}"{{ end }}>
|
||||
{{ .Text -}}
|
||||
</blockquote>
|
||||
{{- end }}
|
||||
6
layouts/_markup/render-heading.html
Normal file
6
layouts/_markup/render-heading.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{{- .Page.Scratch.SetInMap "definedSections" (printf "#%s" .Anchor) true -}}
|
||||
<a href="#{{ .Anchor }}">
|
||||
<h{{ .Level }} id="{{ .Anchor }}">
|
||||
{{- .Text | safeHTML -}}
|
||||
</h{{ .Level }}>
|
||||
</a>
|
||||
32
layouts/_markup/render-link.html
Normal file
32
layouts/_markup/render-link.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{{- $class := "" -}}
|
||||
{{- $icon := "" -}}
|
||||
{{- $absoluteDest := absLangURL .Destination -}}
|
||||
{{- $siteRootUrl := absLangURL "" -}}
|
||||
{{- $isExternal := not (hasPrefix $absoluteDest $siteRootUrl) -}}
|
||||
{{- $isSamePage := hasPrefix .Destination "#" -}}
|
||||
|
||||
{{- if $isSamePage -}}
|
||||
{{- $class = "same-page-link" -}}
|
||||
{{- if index (.Page.Scratch.Get "definedSections") .Destination -}}
|
||||
{{- $icon = "arrow-up" -}}
|
||||
{{- else -}}
|
||||
{{- /* Do not render "down" links because don't know how to distinguish unseen titles from paragraph links. */ -}}
|
||||
{{- /* $icon = "arrow-down" */ -}}
|
||||
{{- end -}}
|
||||
{{- else if $isExternal -}}
|
||||
{{- $class = "external-link" -}}
|
||||
{{- $icon = "external-link" -}}
|
||||
{{- end -}}
|
||||
<a href="{{ .Destination | safeURL }}"
|
||||
{{- with .Title }} title="{{ . }}"{{ end -}}
|
||||
{{- with $class -}}
|
||||
class="{{ . }}"
|
||||
{{- end -}}
|
||||
{{- if (and site.Params.externalLinksInNewTab $isExternal) -}}
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
{{- end -}}
|
||||
>
|
||||
{{- with .Text | safeHTML }}{{ . }}{{ end -}}
|
||||
{{- with $icon -}}{{- partial "icon.html" . -}}{{- end -}}
|
||||
</a>
|
||||
{{- /* chomp trailing newline */ -}}
|
||||
Reference in New Issue
Block a user