fix: ignore malformed organization founding year

This commit is contained in:
pipeline
2026-07-21 22:19:45 +03:00
parent 9f163c2bac
commit 8ce05b2bef
+6 -1
View File
@@ -19,7 +19,12 @@
"sameAs" $sameAs "sameAs" $sameAs
-}} -}}
{{- with $brand.contactEmail -}}{{- if not (in . ".example") -}}{{- $data = merge $data (dict "email" .) -}}{{- end -}}{{- end -}} {{- with $brand.contactEmail -}}{{- if not (in . ".example") -}}{{- $data = merge $data (dict "email" .) -}}{{- end -}}{{- end -}}
{{- with $brand.foundedYear -}}{{- if gt (int .) 0 -}}{{- $data = merge $data (dict "foundingDate" (printf "%d" (int .))) -}}{{- end -}}{{- end -}} {{- with $brand.foundedYear -}}
{{- $year := printf "%v" . -}}
{{- if gt (len (findRE `^[0-9]{4}$` $year)) 0 -}}
{{- $data = merge $data (dict "foundingDate" $year) -}}
{{- end -}}
{{- end -}}
<script type="application/ld+json">{{ $data | jsonify | safeJS }}</script> <script type="application/ld+json">{{ $data | jsonify | safeJS }}</script>
{{- end -}} {{- end -}}