Initial commit
This commit is contained in:
commit
52ae011cb6
16 changed files with 798 additions and 0 deletions
19
layout/_partial/date.ejs
Normal file
19
layout/_partial/date.ejs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<% {
|
||||
const posted = new Date(date);
|
||||
const now = new Date();
|
||||
const day = ((d => {
|
||||
if (d > 3 && d < 21) return d + 'th';
|
||||
switch (d % 10) {
|
||||
case 1: return d + 'st';
|
||||
case 2: return d + 'nd';
|
||||
case 3: return d + 'rd';
|
||||
default: return d + 'th';
|
||||
}
|
||||
})(posted.getDate()));
|
||||
|
||||
const options = now.getFullYear() === posted.getFullYear()
|
||||
? { month: 'long', hour: 'numeric', minute: 'numeric', hour12: true }
|
||||
: { year: 'numeric', month: 'long'};
|
||||
%>
|
||||
<%= day %> <%= posted.toLocaleString('en-US', options).replace(/^(\d+)\s/, '') %>
|
||||
<% } %>
|
||||
12
layout/_partial/feed.ejs
Normal file
12
layout/_partial/feed.ejs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<!-- Default number of columns is two. If 3 is defined, then third column is added-->
|
||||
<div id="masonry">
|
||||
<% page.posts.forEach(function(post) { %>
|
||||
<%- include('post_feed', { post: post }) %>
|
||||
<% }); %>
|
||||
</div>
|
||||
|
||||
<div class="pagination">
|
||||
<% if (page.next) { %>
|
||||
<a href="<%- url_for(page.next_link) %>"></a>
|
||||
<% } %>
|
||||
</div>
|
||||
32
layout/_partial/post_feed.ejs
Normal file
32
layout/_partial/post_feed.ejs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!-- This is the template for the post. It is used to display the posts in the feeds. -->
|
||||
<% if(post.photos && post.photos.length) { %>
|
||||
<% classTag = "post-with-image" %>
|
||||
<% } else { %>
|
||||
<% classTag = "post-without-image" %>
|
||||
<% } %>
|
||||
|
||||
<div class="post-feed border">
|
||||
<a href='<%= url_for(post.path) %>'><h1><%= post.title || "Untitled" %></h1>
|
||||
|
||||
<div class="<%= classTag %>">
|
||||
<% if(post.photos && post.photos.length) { %>
|
||||
<a href='<%= url_for(post.path) %>'>
|
||||
<img class="border" src="<%- config.root %><%- post.photos[0] %>" alt="<%- post.title || 'Untitled' %>">
|
||||
</a>
|
||||
<% } %>
|
||||
<div>
|
||||
|
||||
<div class="date smoll">
|
||||
<a href='<%= url_for(post.path) %>'><%- include('date', { date: post.date.toISOString() }) %></a>
|
||||
</div>
|
||||
|
||||
<p class="post_description"><%= post.description %></p>
|
||||
|
||||
<a href='<%= url_for(post.path) %>'><p>Read More...</p></a>
|
||||
|
||||
<div class="tags smoll">
|
||||
<% post.tags.data.forEach(function(tag) { %>
|
||||
<a href="<%= url_for('/tags/' + tag.slug || tag.name.replace(/\s+/g, '-')) %>">#<%= tag.name %></a>
|
||||
<% }); %>
|
||||
</div>
|
||||
</div>
|
||||
17
layout/_partial/scarves.ejs
Normal file
17
layout/_partial/scarves.ejs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<div class="scarves">
|
||||
<% theme.scarf.forEach(function(scarf, index) { %>
|
||||
<% if (scarf.enable) { %>
|
||||
<a href="<%= scarf.url %>">
|
||||
<div class="scarf" title="<%= scarf.alt %>" style="right: <%= index * 30 %>px;
|
||||
margin-top:-<%= ( (index % 5) * 10) + 40 %>px;
|
||||
background-color:<%= scarf.color ? scarf.color : theme.primary_color %>;">
|
||||
<% if(scarf.image) { %>
|
||||
<img class= "logo" src="<%= url_for(scarf.image) %>" alt="<%= scarf.alt %>">
|
||||
<% } else if(scarf.icon) { %>
|
||||
<i class='logo <%= scarf.icon %>'></i>
|
||||
<% } else%>
|
||||
</div>
|
||||
</a>
|
||||
<% } %>
|
||||
<% }); %>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue