Add: article.ejs file, render the details of the article

This commit is contained in:
XPoet 2020-03-13 22:37:38 +08:00
parent 0302f98917
commit a9c77294f8
3 changed files with 22 additions and 1 deletions

7
layout/article.ejs Normal file
View File

@ -0,0 +1,7 @@
<!-- is_post() 检查当前页面是否为文章 -->
<% if (is_post()) { %>
<h2 class="article-title">文章标题:<%= page.title %> </h2>
<div>本文作者: <%= config.author %> </div>
<div>发布时间:<%= date(page.date, 'YYYY-MM-DD HH:MM:SS') %> </div>
<div class="article-content"> <%- page.content %> </div>
<% } %>

View File

@ -1,7 +1,7 @@
<!-- is_post() 检查当前页面是否为文章 -->
<% if (!is_post()) { %>
<li class="post-item">
<h2>文章标题:<%= post.title %></h2>
<h2>文章标题:<a href="<%- url_for(post.path) %>"><%= post.title %></a></h2>
<h4>生成日期:<%= post.date %></h4>
<h4>文章路径:<%= post.path %></h4>
<h4>文章分类:
@ -15,4 +15,9 @@
<% }); %>
</h4>
</li>
<% } %>
<!-- 如果点开的当前页面是文章内容 -->
<% if (is_post()) { %>
<%- partial('article') %>
<% } %>

View File

@ -38,3 +38,12 @@
.tag-link-item, .category-link-item {
margin 0 5px
}
.article-title {
color: lightseagreen
}
.article-content {
border 2px solid #ccc
padding 10px
margin 10px
}