{{- $page := . -}} {{- $commentsURL := "" -}} {{- $commentsLabel := "Commentaires" -}} {{- $linkClass := "" -}} {{- $linksParam := $page.Params.links -}} {{- if reflect.IsMap . -}} {{- if isset . "Page" -}} {{- $page = index . "Page" -}} {{- end -}} {{- if isset . "CommentsURL" -}} {{- with (index . "CommentsURL") -}} {{- $commentsURL = . -}} {{- end -}} {{- end -}} {{- if isset . "CommentsLabel" -}} {{- with (index . "CommentsLabel") -}} {{- $commentsLabel = . -}} {{- end -}} {{- end -}} {{- if isset . "LinkClass" -}} {{- with (index . "LinkClass") -}} {{- $linkClass = . -}} {{- end -}} {{- end -}} {{- if isset . "Links" -}} {{- $linksParam = index . "Links" -}} {{- end -}} {{- end -}} {{- $links := slice -}} {{- if $linksParam -}} {{- $type := printf "%T" $linksParam -}} {{- if hasPrefix $type "[]" -}} {{- $links = $linksParam -}} {{- else -}} {{- $links = slice $linksParam -}} {{- end -}} {{- end -}} {{- $hasWikipediaLink := false -}} {{- range $links -}} {{- if and (not $hasWikipediaLink) (and .url (in .url "wikipedia.org")) -}} {{- $hasWikipediaLink = true -}} {{- end -}} {{- end -}} {{- $addWikiLink := false -}} {{- if and (eq $page.Kind "term") (not $hasWikipediaLink) -}} {{- $addWikiLink = true -}} {{- end -}} {{- if or (ne $commentsURL "") (gt (len $links) 0) $addWikiLink -}} {{- end -}}