Skip to content

Commit

Permalink
str/fix(archive/tags): bring up and fix pagnition
Browse files Browse the repository at this point in the history
  • Loading branch information
neoFelhz committed Feb 19, 2018
1 parent 581a34c commit fec37c2
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 1 deletion.
73 changes: 73 additions & 0 deletions layout/_pages/timeline.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<div class="container container-timeline">
<div class="timeline">

<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-title">
目前共计 <%= site.posts.length %> 篇文章
</p>
</div>
</div>
</div>
</div>

<% var last = 0, year, yearArr = []; %>

<% site.posts.sort('date', -1).limit(site.posts.length).each(function(post){ %>
<% year = post.date.year(); %>
<% if (last != year){ %>
<% if (yearArr.length != 0){ %>
<% } %>
<% yearArr.push(year); %>
<% last = year; %>
<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon icon-lg"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-title">
<span class="h4"><%= year %></span>
</p>
</div>
</div>
</div>
</div>
<div class="timeline-item">
<div class="timeline-left">
<a class="timeline-icon" href="<%- url_for(post.path) %>"></a>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-subtitle text-gray mb-1"><%= date(post.date, config.date_format) %></p>
<a href="<%- url_for(post.path) %>" style="color: #667189;"><p class="tile-title"><%= post.title %></p></a>
</div>
</div>
</div>
</div>
<% } else { %>
<div class="timeline-item">
<div class="timeline-left">
<a class="timeline-icon" href="<%- url_for(post.path) %>"></a>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-subtitle text-gray mb-1"><%= date(post.date, config.date_format) %></p>
<a href="<%- url_for(post.path) %>" style="color: #667189;"><p class="tile-title"><%= post.title %></p></a>
</div>
</div>
</div>
</div>
<% } %>
<% }) %>

</div>
</div>
6 changes: 5 additions & 1 deletion layout/archive.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<% var last = 0, year, yearArr = []; %>

<% site.posts.sort('date', -1).limit(site.posts.length).each(function(post){ %>
<% page.posts.sort('date', -1).each(function(post){ %>
<% year = post.date.year(); %>
<% if (last != year){ %>
<% if (yearArr.length != 0){ %>
Expand Down Expand Up @@ -71,3 +71,7 @@

</div>
</div>

<div class="container container-index-nav">
<%- partial('_partial/index-nav') %>
</div>
85 changes: 85 additions & 0 deletions layout/tag.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<% if( is_tag() ) { %>
<div class="container container-timeline">
<div class="timeline">
<div class="timeline-item">
<div class="timeline-left">
<div class="timeline-icon icon-lg"></div>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-title">
<span class="h4"><%= page.tag %></span>
</p>
</div>
</div>
</div>
</div>
<% page.posts.sort('date', -1).each(function(post){ %>
<div class="timeline-item">
<div class="timeline-left">
<a class="timeline-icon" href="<%- url_for(post.path) %>"></a>
</div>
<div class="timeline-content">
<div class="tile">
<div class="tile-content">
<p class="tile-subtitle text-gray mb-1"><%= date(post.date, config.date_format) %></p>
<a href="<%- url_for(post.path) %>" style="color: #667189;"><p class="tile-title"><%= post.title %></p></a>
</div>
</div>
</div>
</div>
<% }) %>
</div>
</div>
<div class="container container-index-nav">
<%- partial('_partial/index-nav') %>
</div>
<% } else { %>
<style>
.tagscloud {
margin: 4rem 1.2rem 3rem;
padding: 0 1rem;
}
@media screen and (max-width: 480px) {
.tagscloud {
padding: 0;
}
}
.tagscloud a {
text-decoration:none;
padding: .1rem .5rem;
margin: .5rem .1rem;
line-height: 2rem;
white-space: nowrap;
transition: .6s;
opacity: .85;
}
.tagscloud a:hover {
transition: .6s;
opacity: 1;
background-color: #fafafa;
padding: .75rem;
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
}
</style>
<div class="tagscloud">
<%- tagcloud({
min_font: 16,
max_font: 35,
amount: 9999,
color: true,
start_color: '#757575',
end_color: '#212121',
}) %>
</div>
<% } %>

0 comments on commit fec37c2

Please sign in to comment.