schema.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. {{ $isPage := or (and (ne .Type "posts") (in "section page" .Kind )) (and (eq .Type "posts") (eq .Kind "page")) }}
  2. {{- if eq .Kind "home" }}
  3. <script type="application/ld+json">
  4. {
  5. "@context": "http://schema.org",
  6. "@type": "WebSite",
  7. "name": {{ .Site.Title }},
  8. "url": {{ .Site.Home.Permalink }},
  9. {{- with partial "utils/description" . }}
  10. "description": "{{ . | plainify | htmlUnescape | chomp }}",
  11. {{- end }}
  12. {{- with partial "utils/featured" . }}
  13. "thumbnailUrl": {{ . }},
  14. {{- end }}
  15. {{- with .Site.Params.geekdocContentLicense }}
  16. "license": "{{ .name }}",
  17. {{- end }}
  18. "inLanguage": {{ .Lang }}
  19. }
  20. </script>
  21. {{- else if $isPage }}
  22. <script type="application/ld+json">
  23. {
  24. "@context": "http://schema.org",
  25. "@type": "TechArticle",
  26. "articleSection": "{{ .Section | humanize | title }}",
  27. "name": {{ partial "utils/title" . }},
  28. "url" : {{ .Permalink }},
  29. "headline": {{ partial "utils/title" . }},
  30. {{- with .Params.lead }}
  31. "alternativeHeadline": {{ . }},
  32. {{- end }}
  33. {{- with partial "utils/description" . }}
  34. "description": "{{ . | plainify | htmlUnescape | chomp }}",
  35. {{- end }}
  36. {{- with partial "utils/featured" . }}
  37. "thumbnailUrl": {{ . }},
  38. {{- end }}
  39. "wordCount" : "{{ .WordCount }}",
  40. {{- with .Site.Params.geekdocContentLicense }}
  41. "license": "{{ .name }}",
  42. {{- end }}
  43. "inLanguage": {{ .Lang }},
  44. "isFamilyFriendly": "true",
  45. "mainEntityOfPage": {
  46. "@type": "WebPage",
  47. "@id": {{ .Permalink }}
  48. },
  49. {{- with $tags := .Params.tags }}
  50. "keywords" : [ {{ range $i, $tag := $tags }}{{ if $i }}, {{ end }}"{{ $tag }}" {{ end }}],
  51. {{- end }}
  52. "copyrightHolder" : "{{ .Site.Title }}",
  53. "copyrightYear" : "{{ .Date.Format "2006" }}",
  54. "dateCreated": "{{ .Date.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
  55. "datePublished": "{{ .PublishDate.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
  56. "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05.00Z" | safeJS }}",
  57. "publisher":{
  58. "@type":"Organization",
  59. "name": {{ .Site.Title }},
  60. "url": {{ .Site.Home.Permalink }},
  61. "logo": {
  62. "@type": "ImageObject",
  63. "url": {{ (default "brand.svg" .Site.Params.logo) | absURL }},
  64. "width":"32",
  65. "height":"32"
  66. }
  67. }
  68. }
  69. </script>
  70. {{- end }}