Skip to content

Commit

Permalink
feat: write structured data for seo
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcticLampyrid committed Apr 19, 2022
1 parent 546b25d commit cb6ddac
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 39 deletions.
12 changes: 6 additions & 6 deletions layout/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@
</div>
<% } %>
<% if (post.title) { %>
<article class="post" itemscope>
<article class="post" itemscope itemtype="https://schema.org/Article">
<header class="post-header">
<h3 class="post-title">
<% if (post.link) { %>
<a class="post-title-link post-title-link-external" target="_blank" href="<%- url_for(post.link) %>" itemprop="url">
<%- post.title %>
<a class="post-title-link post-title-link-external" target="_blank" href="<%- url_for(post.link) %>" itemprop="mainEntityOfPage">
<span itemprop="name headline"><%- post.title %></span>
<i class="fa fa-external-link"></i>
</a>
<% } else { %>
<a class="post-title-link" href="<%- url_for(post.path) %>" itemprop="url">
<span itemprop="name"><%- post.title %></span>
<a class="post-title-link" href="<%- url_for(post.path) %>" itemprop="mainEntityOfPage">
<span itemprop="name headline"><%- post.title %></span>
</a>
<% } %>
</h3>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
<time class="post-time" itemprop="datePublished"
datetime="<%- moment(post.date).format() %>"
content="<%- date(post.date, config.date_format) %>" >
<%- date(post.date, 'MM-DD') %>
Expand Down
32 changes: 17 additions & 15 deletions layout/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@
}
} %>
<% if (!post.title || post.link) { %>
<article class="kratos-hentry kratos-entry-border-new clearfix">
<article class="kratos-hentry kratos-entry-border-new clearfix" itemscope itemtype="https://schema.org/Article">
<div class="kratos-status">
<% if (post.link) { %>
<i class="fa fa-link"></i>
<% } else { %>
<i class="fa fa-refresh"></i>
<% } %>
<div class="kratos-status-inner">
<div class="kratos-status-content">
<div class="kratos-status-content" itemprop="articleBody">
<% if (post.link) { %>
<a href="<%- url_for(post.link) %>"><%- post.title %> <i class="fa fa-external-link"></i></a>
<% } else { %>
Expand All @@ -84,7 +84,9 @@
<% if (!post.link || post.comments) { %>
<footer class="kratos-post-meta-new">
<span class="pull-left">
<a><i class="fa fa-calendar"></i></a><a><%- date(post.date, null) %></a>
<time datetime="<%= date_xml(page.date) %>" itemprop="datePublished">
<a><i class="fa fa-calendar"></i> <%- date(page.date, null) %></a>
</time>
<% if (post.tags.length) { %>
<a><i class="fa fa-tags"></i></a>
<%- list_tags(post.tags, {
Expand Down Expand Up @@ -123,7 +125,7 @@
<% } %>
</article>
<% } else if (theme.index && theme.index.post_type) { %>
<article>
<article itemscope itemtype="https://schema.org/Article">
<div class="kratos-hentry kratos-post-inner clearfix index-post">
<div class="kratos-entry-thumb-new">
<a href="<%- url_for(post.path) %>">
Expand All @@ -133,14 +135,15 @@
</a>
</div>
<header class="kratos-entry-header">
<h1 class="text-center"><a class="kratos-entry-title" href="<%- url_for(post.path) %>"><%- post.title %></a></h1>
<h1 class="text-center"><a class="kratos-entry-title" href="<%- url_for(post.path) %>" itemprop="mainEntityOfPage"><span itemprop="name headline"><%- post.title %></span></a></h1>
<% if (post.subtitle) { %>
<h2 class="text-center"><%- post.subtitle %></h2>
<% } %>
<ul class="kratos-post-meta text-center">
<li>
<i class="fa fa-calendar"></i>
<%- date(post.date, null) %>
<time datetime="<%= date_xml(page.date) %>" itemprop="datePublished">
<i class="fa fa-calendar"></i> <%- date(page.date, null) %>
</time>
</li>
<% if (post.categories.length) { %>
<li>
Expand Down Expand Up @@ -185,7 +188,7 @@
</ul>
</header>
<hr />
<div class="kratos-post-content">
<div class="kratos-post-content" itemprop="articleBody">
<%- post.excerpt || post.content %>
</div>
<footer class="kratos-entry-footer clearfix">
Expand All @@ -196,7 +199,7 @@
</div>
</article>
<% } else { %>
<article class="kratos-hentry clearfix">
<article class="kratos-hentry clearfix" itemscope itemtype="https://schema.org/Article">
<div class="kratos-entry-border-new clearfix">
<% if (post.sticky || post.top) { %>
<div class="pin-top wrapper">
Expand All @@ -220,10 +223,10 @@
style: 'none',
separator: ' '
}) %>
<h2 class="kratos-entry-title-new"><a href="<%- url_for(post.path) %>"><%- post.title %><% if (post.subtitle) { %><sub><%- post.subtitle %></sub><% } %></a>
<h2 class="kratos-entry-title-new"><a href="<%- url_for(post.path) %>" itemprop="mainEntityOfPage"><span itemprop="name headline"><%- post.title %><% if (post.subtitle) { %><sub><%- post.subtitle %></sub><% } %></span></a>
</header>
<div class="kratos-entry-content-new">
<p>
<p itemProp="description">
<% if (post.excerpt) { %>
<%- strip_html(post.excerpt) %>
<% } else { %>
Expand All @@ -234,10 +237,9 @@
</div>
<footer class="kratos-post-meta-new">
<span class="pull-left">
<a>
<i class="fa fa-calendar"></i>
<%- date(post.date, null) %>
</a>
<time datetime="<%= date_xml(page.date) %>" itemprop="datePublished">
<a><i class="fa fa-calendar"></i> <%- date(page.date, null) %></a>
</time>
<a>
<% if (post.tags.length) { %>
<i class="fa fa-tags"></i>
Expand Down
9 changes: 5 additions & 4 deletions layout/page.ejs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<article>
<article itemscope itemtype="https://schema.org/Article">
<link itemprop="mainEntityOfPage" href="<%= page.permalink %>">
<div class="kratos-hentry kratos-post-inner clearfix">
<div class="kratos-post-content">
<h2 class="title-h2 text-center"><%- page.title %></h2>
<%- page.content %>
<h2 class="title-h2 text-center" itemprop="name headline"><%- page.title %></h2>
<div itemprop="articleBody"><%- page.content %></div>
</div>
<footer class="kratos-entry-footer clearfix">
<div class="footer-tag clearfix">
<div class="pull-date">
<span><%- __('last_modify') %><%- date(page.updated) %></span>
<time datetime="<%= date_xml(page.updated) %>" itemprop="dateModified"><%- __('last_modify') %><%- date(page.updated) %></time>
</div>
</div>
</footer>
Expand Down
17 changes: 10 additions & 7 deletions layout/post.ejs
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<article>
<article itemscope itemtype="https://schema.org/Article">
<% const commentProvider = theme.posts.comments?.provider ?? theme.posts.comments; %>
<link itemprop="mainEntityOfPage" href="<%= page.permalink %>">
<div class="kratos-hentry kratos-post-inner clearfix">
<header class="kratos-entry-header">
<% if (page.title) { %>
<h1 class="kratos-entry-title text-center"><%- page.title %></h1>
<h1 class="kratos-entry-title text-center" itemprop="name headline"><%- page.title %></h1>
<% } %>
<% if (page.subtitle) { %>
<h2 class="text-center"><%- page.subtitle %></h2>
<% } %>
<ul class="kratos-post-meta text-center">
<li><i class="fa fa-calendar"></i> <%- date(page.date, null) %></li>
<li><i class="fa fa-user"></i> <%- __('author') %> <%- page.author || config.author %></li>
<li><time datetime="<%= date_xml(page.date) %>" itemprop="datePublished"><i class="fa fa-calendar"></i> <%- date(page.date, null) %></time></li>
<li itemprop="author" itemscope itemtype="https://schema.org/Person">
<i class="fa fa-user"></i> <%- __('author') %> <span itemprop="name"><%- page.author || config.author %></span>
</li>
<li>
<i class="fa fa-edit"></i>
<% const wordsCount = strip_html(page.content).length; %>
Expand Down Expand Up @@ -46,11 +49,11 @@
</div>
<% } %>
<hr />
<%- page.content %>
<div itemprop="articleBody"><%- page.content %></div>
</div>
<% if (typeof page.show_cc !== 'undefined' ? page.show_cc : theme.posts.show_cc) { %>
<div class="kratos-copyright text-center clearfix">
<h5><%- __('use_cc4_license') %></h5>
<h5 itemprop="copyrightNotice"><%- __('use_cc4_license') %></h5>
</div>
<% } %>
<footer class="kratos-entry-footer clearfix">
Expand All @@ -74,7 +77,7 @@
}) %>
</div>
<div class="pull-date">
<span><%- __('last_modify') %><%- date(page.updated) %></span>
<time datetime="<%= date_xml(page.updated) %>" itemprop="dateModified"><%- __('last_modify') %><%- date(page.updated) %></time>
</div>
</div>
</footer>
Expand Down
2 changes: 1 addition & 1 deletion source/css/kr-color-dark.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion source/css/kratosr.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit cb6ddac

Please sign in to comment.