external.html 941 B

1234567891011121314151617181920212223242526272829
  1. {{- $List := index .Context.Site.Data.external .Namespace -}}
  2. {{- with $List -}}
  3. {{- range . -}}
  4. {{- if eq .type "script" -}}
  5. <script
  6. src="{{ .src }}"
  7. {{- with .integrity -}}
  8. integrity="{{ . }}"
  9. {{- end -}}
  10. crossorigin="anonymous"
  11. {{ if .defer }}defer{{ end }}
  12. >
  13. </script>
  14. {{- else if eq .type "style" -}}
  15. <link
  16. rel="stylesheet"
  17. href="{{ .src }}"
  18. {{- with .integrity -}}
  19. integrity="{{ . }}"
  20. {{- end -}}
  21. crossorigin="anonymous"
  22. >
  23. {{- else -}}
  24. {{- errorf "Error: unknown external resource type: %s" .type -}}
  25. {{- end -}}
  26. {{- end -}}
  27. {{- else -}}
  28. {{- errorf "Error: external resource '%s' is not found" .Namespace -}}
  29. {{- end -}}