Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ menu:
name: tags
theme: solid
link: /tags
Friends:
name: user-group
theme: solid
link: /friends

# Side info card
card:
Expand Down
144 changes: 72 additions & 72 deletions layout/categories.ejs
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
<div id="archives">
<% let posts = []; %>
<div class="categories-tags">
<% let prev; %>
<% site.categories.forEach((category) => { %>
<%
const colors = is_category(category.name)
? ["linear-gradient(120deg, #9abbf7 0%, #ffbbf4 100%)"]
: theme.colors.filter((color) => color !== prev);
let id = Math.floor(Math.random() * colors.length);
prev = colors[id];
%>
<span>
<a href="<%- url_for(category.path) %>" style="background: <%- colors[id] %>">
<span class="icon">
<i class="fa-solid fa-bookmark fa-fw"></i>
</span>
<%= category.name %>
</a>
</span>
<% if (is_category(category.name)) { %>
<%
posts = category.posts;
posts.data.sort((a, b) => b.date - a.date);
%>
<% } %>
<% }); %>
</div>
<% posts.forEach((post) => { %>
<div class="timeline">
<div class="timeline-tail"></div>
<div class="timeline-content">
<div class="item-time"><%= date(post.date, "YYYY/M/D") %></div>
<a href="<%- url_for(post.path) %>">
<h3><%= post.title %></h3>
</a>
<div class="info">
<% if (post.categories && post.categories.data.length !== 0) { %>
<span class="category">
<a href="<%- url_for(post.categories.data[0].path) %>">
<span class="icon">
<i class="fa-solid fa-bookmark fa-fw"></i>
</span>
<%= post.categories.data[0].name %>
</a>
</span>
<% } %>
<% if (post.tags && post.tags.data.length !== 0) { %>
<span class="tags">
<span class="icon">
<i class="fa-solid fa-tags fa-fw"></i>
</span>
<% let prev; %>
<% post.tags.data.forEach((tag) => { %>
<span class="tag">
<%
const colors = theme.colors.filter((color) => color !== prev);
let id = Math.floor(Math.random() * colors.length);
prev = colors[id];
%>
<a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>">
<%= tag.name %>
</a>
</span>
<% }); %>
</span>
<% } %>
</div>
</div>
</div>
<% }); %>
</div>
<div id="archives">
<% let posts = []; %>
<div class="categories-tags">
<% let prev; %>
<% site.categories.forEach((category) => { %>
<%
const colors = is_category(category.name)
? ["linear-gradient(120deg, #9abbf7 0%, #ffbbf4 100%)"]
: theme.colors.filter((color) => color !== prev);
let id = Math.floor(Math.random() * colors.length);
prev = colors[id];
%>
<span>
<a href="<%- url_for(category.path) %>" style="background: <%- colors[id] %>">
<span class="icon">
<i class="fa-solid fa-bookmark fa-fw"></i>
</span>
<%= category.name %>
</a>
</span>
<% if (is_category(category.name)) { %>
<%
posts = category.posts;
posts.data.sort((a, b) => b.date - a.date);
%>
<% } %>
<% }); %>
</div>
<% posts.forEach((post) => { %>
<div class="timeline">
<div class="timeline-tail"></div>
<div class="timeline-content">
<div class="item-time"><%= date(post.date, "YYYY/M/D") %></div>
<a href="<%- url_for(post.path) %>">
<h3><%= post.title %></h3>
</a>
<div class="info">
<% if (post.categories && post.categories.data.length !== 0) { %>
<span class="category">
<a href="<%- url_for(post.categories.data[0].path) %>">
<span class="icon">
<i class="fa-solid fa-bookmark fa-fw"></i>
</span>
<%= post.categories.data[0].name %>
</a>
</span>
<% } %>
<% if (post.tags && post.tags.data.length !== 0) { %>
<span class="tags">
<span class="icon">
<i class="fa-solid fa-tags fa-fw"></i>
</span>
<% let prev; %>
<% post.tags.data.forEach((tag) => { %>
<span class="tag">
<%
const colors = theme.colors.filter((color) => color !== prev);
let id = Math.floor(Math.random() * colors.length);
prev = colors[id];
%>
<a href="<%- url_for(tag.path) %>" style="color: <%- colors[id] %>">
<%= tag.name %>
</a>
</span>
<% }); %>
</span>
<% } %>
</div>
</div>
</div>
<% }); %>
</div>
132 changes: 66 additions & 66 deletions layout/comment.ejs
Original file line number Diff line number Diff line change
@@ -1,66 +1,66 @@
<% if (theme.giscus.enable) { %>
<script
src="<%- theme.giscus.src %>"
data-repo="<%- theme.giscus.repo %>"
data-repo-id="<%- theme.giscus.repoID %>"
data-category="<%- theme.giscus.category %>"
data-category-id="<%- theme.giscus.categoryID %>"
data-mapping="<%- theme.giscus.mapping %>"
data-strict="<%- theme.giscus.strict %>"
data-reactions-enabled="<%- theme.giscus.reactionsEnabled %>"
data-emit-metadata="<%- theme.giscus.emitMetadata %>"
data-input-position="<%- theme.giscus.inputPosition %>"
data-theme="<%- theme.giscus.theme %>"
data-lang="<%- theme.giscus.lang %>"
crossorigin
async
></script>
<% } %>
<% if (theme.gitalk.enable) { %>
<script>
const gitalk = new Gitalk({
clientID: "<%- theme.gitalk.clientID %>",
clientSecret: "<%- theme.gitalk.clientSecret %>",
repo: "<%- theme.gitalk.repo %>",
owner: "<%- theme.gitalk.owner %>",
admin: "<%- theme.gitalk.admin %>".split(","),
language: "<%- theme.gitalk.language %>",
id: location.pathname,
<% if (theme.gitalk.proxy) { %>
proxy: "<%- theme.gitalk.proxy %>",
<% } %>
})
gitalk.render("gitalk-container");
</script>
<% } %>
<% if (theme.waline.enable) { %>
<script>
Waline.init({
el: "#waline-container",
serverURL: "<%- theme.waline.serverURL %>",
commentCount: <%- theme.waline.commentCount %>,
pageview: <%- theme.waline.pageview %>,
emoji: "<%- (theme.waline.emoji) %>".split(","),
meta: "<%- (theme.waline.meta) %>".split(","),
requiredMeta: "<%- theme.waline.requiredMeta %>".split(","),
lang: "<%- theme.waline.lang %>",
wordLimit: <%- theme.waline.wordLimit %>,
pageSize: "<%- theme.waline.pageSize %>",
login: "<%- theme.waline.login %>",
<% if (theme.waline.locale) { %>
locale: <%- JSON.stringify(theme.waline.locale) %>,
<% } %>
});
</script>
<% } %>
<% if (theme.twikoo.enable) { %>
<script>
twikoo.init({
el: "#twikoo-container",
envId: "<%- theme.twikoo.envID %>",
region: "<%- theme.twikoo.region %>",
path: <%- theme.twikoo.path %>,
lang: "<%- theme.twikoo.lang %>",
})
</script>
<% } %>
<% if (theme.giscus.enable) { %>
<script
src="<%- theme.giscus.src %>"
data-repo="<%- theme.giscus.repo %>"
data-repo-id="<%- theme.giscus.repoID %>"
data-category="<%- theme.giscus.category %>"
data-category-id="<%- theme.giscus.categoryID %>"
data-mapping="<%- theme.giscus.mapping %>"
data-strict="<%- theme.giscus.strict %>"
data-reactions-enabled="<%- theme.giscus.reactionsEnabled %>"
data-emit-metadata="<%- theme.giscus.emitMetadata %>"
data-input-position="<%- theme.giscus.inputPosition %>"
data-theme="<%- theme.giscus.theme %>"
data-lang="<%- theme.giscus.lang %>"
crossorigin
async
></script>
<% } %>
<% if (theme.gitalk.enable) { %>
<script>
const gitalk = new Gitalk({
clientID: "<%- theme.gitalk.clientID %>",
clientSecret: "<%- theme.gitalk.clientSecret %>",
repo: "<%- theme.gitalk.repo %>",
owner: "<%- theme.gitalk.owner %>",
admin: "<%- theme.gitalk.admin %>".split(","),
language: "<%- theme.gitalk.language %>",
id: location.pathname,
<% if (theme.gitalk.proxy) { %>
proxy: "<%- theme.gitalk.proxy %>",
<% } %>
})
gitalk.render("gitalk-container");
</script>
<% } %>
<% if (theme.waline.enable) { %>
<script>
Waline.init({
el: "#waline-container",
serverURL: "<%- theme.waline.serverURL %>",
commentCount: <%- theme.waline.commentCount %>,
pageview: <%- theme.waline.pageview %>,
emoji: "<%- (theme.waline.emoji) %>".split(","),
meta: "<%- (theme.waline.meta) %>".split(","),
requiredMeta: "<%- theme.waline.requiredMeta %>".split(","),
lang: "<%- theme.waline.lang %>",
wordLimit: <%- theme.waline.wordLimit %>,
pageSize: "<%- theme.waline.pageSize %>",
login: "<%- theme.waline.login %>",
<% if (theme.waline.locale) { %>
locale: <%- JSON.stringify(theme.waline.locale) %>,
<% } %>
});
</script>
<% } %>
<% if (theme.twikoo.enable) { %>
<script>
twikoo.init({
el: "#twikoo-container",
envId: "<%- theme.twikoo.envID %>",
region: "<%- theme.twikoo.region %>",
path: <%- theme.twikoo.path %>,
lang: "<%- theme.twikoo.lang %>",
})
</script>
<% } %>
20 changes: 20 additions & 0 deletions layout/friends.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<link rel="stylesheet" href="<%- url_for('/css/friends.css') %>">

<div class="friends-container">
<h1 class="friends-title">My Friends</h1>

<ul class="friends-list">
<% const friends = site.data.friends; %>
<% friends.forEach(friend => { %>
<li class="friend-item">
<img src="<%= friend.avatar %>" class="avatar" loading="lazy" onerror="this.src='/images/default_avatar.svg'"/>
<div class="friend-url">
<a href="<%= friend.url %>">
<div class="friend-name"><%= friend.name %></div>
<div class="friend-des"><%= friend.des %></div>
</a>
</div>
</li>
<% }) %>
</ul>
</div>
13 changes: 11 additions & 2 deletions layout/layout.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
<%
let type = "post";
if (is_home()) type = "index";
if (is_post() || is_page()) type = "post";
if (is_post()) {
type = "post";
} else if (is_page()) {
if (page.type === "friends") {
type = "friends";
} else {
type = "post"; // 默认 page 还是走 post 模板
}
}
if (is_category() || page.type === "categories") type = "categories";
if (is_tag() || page.type === "tags") type = "tags";
if (is_archive()) type = "archives";
Expand All @@ -11,6 +19,7 @@
if (is_category()) title = "Categories: " + page.category + " | " + config.title;
if (is_tag()) title = "Tags: " + page.tag + " | " + config.title;
if (is_archive()) title = "Archives | " + config.title;
if (page.type === "friends") title = "Friends | " + config.title;
%>
<!DOCTYPE html>
<html lang="<%- config.language %>">
Expand Down Expand Up @@ -56,4 +65,4 @@
<%- partial("comment") %>
<% } %>
</body>
</html>
</html>
Loading