Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
添加文章信息显示 #28
Browse files Browse the repository at this point in the history
  • Loading branch information
maodaisuki committed Oct 14, 2023
1 parent 68745c5 commit eb7bbb3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 11 deletions.
7 changes: 7 additions & 0 deletions _config.maoblog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ tag_generator:
# 0 设置为每页不限制数量
order_by: -date

# 控制文章信息
meta_time:
enable: true

meta_tags:
enable: true

analytics:
enable: true
gtag: AW-11373423003
1 change: 1 addition & 0 deletions themes/maoblog/layout/partials/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<%- css('css/partials/post') %>
<%- css('css/partials/comment') %>
<%- css('css/partials/search') %>
<%- css('css/partials/meta') %>
<%- css('fontawesome/css/font-awesome.min') %>
<%- css('css/zoom.css') %>
<%- css('css/prism.css') %>
Expand Down
25 changes: 19 additions & 6 deletions themes/maoblog/layout/post.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
<div class="main-container">
<div class="post-details">
<% if (is_post()) { %>
<div class="post-title">
<h1><%= page.title %></h1>
</div>
<div class="post-meta">
<!-- <i class="fa fa-calendar"></i>&nbsp;&nbsp;<span class="post-date"><%= date(page.date, 'YYYY/MM/DD') %></span> -->
</div>
<div class="post-title">
<h1><%= page.title %></h1>
</div>
<div class="post-meta">
<% if(theme.meta_time.enable) {%>
<div class="post-date">
<i class="fa fa-calendar"></i>&nbsp;&nbsp;<span class="post-date"><%= date(page.date, 'YYYY/MM/DD') %></span>
</div>
<% } %>
<% if(theme.meta_tags.enable) { %>
<div class="post-tags">
<% page.tags.each(function(tag) { %>
<div class="tag-item">
<a href="<%- url_for(tag.path) %>"><i class="fa fa-tag"></i> <%= tag.name %></a>
</div>
<%})%>
</div>
<% } %>
</div>
<% } %>
<div class="post-content">
<%- page.content %>
Expand Down
16 changes: 16 additions & 0 deletions themes/maoblog/source/css/partials/meta.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.post-meta
margin-bottom: 20px
color: var(--markdown-color)

.post-date
font-size: 13px
margin: 3px 0

.post-tags
font-size: 13px
margin-bottom: 3px

.tag-item
display: inline
margin-right: 2px
margin-bottom: 2px
5 changes: 0 additions & 5 deletions themes/maoblog/source/css/partials/post.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
margin-bottom: 5px
margin-block: 0

.post-meta
margin-bottom: 20px
font-size: 13px
color: var(--markdown-color)

.post-content
h1
h2
Expand Down

0 comments on commit eb7bbb3

Please sign in to comment.