diff --git a/layouts/_default/contact.html b/layouts/_default/contact.html index 5c53a76c9..8422d2630 100644 --- a/layouts/_default/contact.html +++ b/layouts/_default/contact.html @@ -4,7 +4,7 @@
- {{ with site.Params.contact.form }}{{ if .enable }} + {{ with site.Params.contact.form }}{{ if .enable -}}
@@ -21,11 +21,11 @@
- {{ if .use_netlify }} + {{ if .use_netlify -}}
- {{ end -}} + {{- end }}
@@ -39,26 +39,27 @@
- {{ end }}{{ end }} + {{- end }}{{ end }}
- {{ with site.Params.contact }} + {{ with site.Params.contact -}}

{{ i18n "address_title" }}

    - {{ if isset . "location" }}
  • {{ if .address_descriptors }}{{ i18n "location" | printf "%s: " }}{{ end }}
    {{ .location | markdownify }}
  • {{ end }} - {{ if isset . "email" }}
  • {{ if .address_descriptors }}{{ i18n "email" | printf "%s: " }}{{ end }}{{ partial "cloak_email" .email }}
  • {{ end }} - {{ if isset . "phone" }}
  • {{ if .address_descriptors }}{{ i18n "phone" | printf "%s: " }}{{ end }}{{ .phone }}
  • {{ end }} + {{ $add_address_descriptors := .address_descriptors }} + {{ with .location }}
  • {{ if $add_address_descriptors }}{{ i18n "location" | printf "%s: " }}{{ end }}
    {{ . | markdownify }}
  • {{ end }} + {{ with .email }}
  • {{ if $add_address_descriptors }}{{ i18n "email" | printf "%s: " }}{{ end }}{{ partial "cloak_email" . }}
  • {{ end }} + {{ with .phone }}
  • {{ if $add_address_descriptors }}{{ i18n "phone" | printf "%s: " }}{{ end }}{{ . }}
  • {{ end }}
- {{ end }} - {{ if site.Params.gmap.enable }} + {{- end }} + {{ if site.Params.gmap.enable -}}
@@ -66,7 +67,7 @@

{{ i18n "address_title" }}

- {{ end }} + {{- end }}
diff --git a/layouts/partials/cloak_email.html b/layouts/partials/cloak_email.html index 9cd7aa961..cd631de13 100644 --- a/layouts/partials/cloak_email.html +++ b/layouts/partials/cloak_email.html @@ -1,6 +1,10 @@ {{/* Cloak an e-mail address (first argument) */ -}} {{- $address_parts := split . "@" -}} +{{- if (eq (len $address_parts) 2) -}} {{- $user := index $address_parts 0 -}} {{- $domain := index $address_parts 1 -}} +{{- else -}} +INVALID E-MAIL ADDRESS +{{- end -}} {{- /* Dummy comment to strip trailing newline */ -}}