Skip to content

Instantly share code, notes, and snippets.

@eddturtle
Last active September 28, 2017 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddturtle/7c0a5f8c1d23c104ac6eac9db3732889 to your computer and use it in GitHub Desktop.
Save eddturtle/7c0a5f8c1d23c104ac6eac9db3732889 to your computer and use it in GitHub Desktop.
Hugo ld+json example
<script type="application/ld+json">
{{ if .IsPage }}{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "{{ .Title }}",
"genre": "{{ range .Params.categories }}{{ . }}{{ end }}",
"url": "{{ .Permalink }}",
"datePublished": "{{ (time .Date).Format "2006-01-02T15:04:05-0700" | safeHTML }}",
"description": "{{ .Summary }}",
"author": {
"@type": "Person",
"name": "{{ .Site.Params.author }}"
}
}{{ else }}{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "{{ .Permalink }}",
"name": "{{ .Site.Title }}",
"author": {
"@type": "Person",
"name": "{{ .Site.Params.author }}"
},
"description": "{{ .Site.Params.description }}",
}{{ end }}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment