nicenote/themes/material/layout/_partial/structured-data.ejs
2018-07-13 19:29:56 +08:00

56 lines
1.7 KiB
Plaintext
Executable File

<% if( (page.current === 1) && (is_home()) ) { %>
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Website",
"publisher": {
"@type": "Organization",
"name": "<%= config.title %>",
"logo": "<%= theme.head.high_res_favicon %>"
},
"url": "<%- config.url + url_for(path) %>",
"image": {
"@type": "ImageObject",
"url": "<%= theme.head.apple_touch_icon %>"
},
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "<%= config.url %>"
},
"description": "<%= config.description %>"
}
</script>
<% } %>
<% if( (is_post()) ) { %>
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"publisher": {
"@type": "Organization",
"name": "<%= config.title %>",
"logo": "<%= theme.head.high_res_favicon %>"
},
"author": {
"@type": "Person",
"name": "<%= config.author %>",
"image": {
"@type": "ImageObject",
"url": "<%= theme.head.apple_touch_icon %>"
},
"description": "<%- theme.uiux.slogan %>"
},
"headline": "<%- page.title %>",
"url": "<%- config.url + url_for(path) %>",
"datePublished": "<%= date(page.date, 'MMM DD, YYYY') %>",
"dateModified": "<%= date(page.updated, 'MMM DD, YYYY') %>",
"description": "<% if(page.description) { %><%= page.description %><% } else if(page.excerpt){ %><%= strip_html(page.excerpt).replace(/^s*/, '').replace(/s*$/, '') %><% } else if (config.description){ %><%= config.description %><% } %>",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "<%= config.url %>"
}
}
</script>
<% } %>