Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Add application/ld+json to posts and pages
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofranssen authored and = committed Dec 28, 2018
1 parent 97232ca commit 091b129
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions layout/common/article.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
<%- partial('share/index', { post: post }) %>
</footer>
</div>
<%- partial('post/ld_json', { post: post }) %>
</article>
<%- partial('comment/index') %>
20 changes: 20 additions & 0 deletions layout/common/post/ld_json.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"author": {
"@type": "Person",
"name": "<%= config.author %>"
},
"headline": "<%= post.title %>",
"image": "<%- url_for(config.url + thumbnail(post)) %>",
<% if (post.tags) { %>"keywords": "<%- post.tags.map(t => t.name).join(' ') %>",<% } %>
<% if (post.categories) { %>"genre": "<%- post.categories.map(c => c.name).join(' ') %>",<% } %>
"datePublished": "<%- date(post.date, 'YYYY-MM-DD') %>",
"dateCreated": "<%- date(post.date, 'YYYY-MM-DD') %>",
"dateModified": "<%- date(post.updated, 'YYYY-MM-DD') %>",
"url": "<%- url_for(config.url + '/' + post.path) %>",
"description": "<%- excerpt(post) %>"
"wordCount": <%- post.content.split(' ').length %>
}
</script>
2 changes: 1 addition & 1 deletion layout/plugin/google-analytics.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
ga('create', '<%= theme.plugins.google_analytics %>', 'auto');
ga('send', 'pageview');
</script>
</script>

0 comments on commit 091b129

Please sign in to comment.