{{ if .Site.Params.schema }}
<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "{{ .Site.Params.schema.type }}",
    "name": "{{ .Site.Params.schema.name }}",
    "url": "{{ .Site.BaseURL }}",
    "description": "{{ .Site.Params.schema.description }}",
    "sameAs": [
        {{ range $index, $url := .Site.Params.schema.sameAs }}{{ if $index }}, {{ end }}"{{ $url }}"{{ end }}
    ]
}
</script>
{{ end }}

{{ if .IsPage }}
<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "BlogPosting",
    "headline": "{{ .Title }}",
    "genre": "{{ .Params.categories | default "Blog" }}",  
    "wordcount": "{{ .WordCount }}",
    "url": "{{ .Permalink }}",
    "datePublished": "{{ .Date.Format "2006-01-02T15:04:05-07:00" }}",
    "dateModified": "{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" }}",
    "description": "{{ .Description | default .Summary }}",
    "author": {
        "@type": "Person",
        "name": "{{ .Site.Params.author }}"
    }
}
</script>
{{ end }}