Skip to content
Closed
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
12 changes: 12 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,18 @@ links:
avatar: "/img/favicon.png"
}

# 失效/未激活的友链
inactive:
enable: false
label: "异常友链 | 长时间不可访问站点"
inactiveItems:
- {
title: "404 Links",
intro: "404 Links",
link: "https://hexo.fluid-dev.com/404",
avatar: "/img/favicon.png"
}

# 当成员头像加载失败时,替换为指定图片
# When the member avatar fails to load, replace the specified image
onerror_avatar: /img/avatar.png
Expand Down
34 changes: 33 additions & 1 deletion layout/links.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ page.comment = theme.links.comments.type
<% for(const each of theme.links.items || []) { %>
<% if (!each.title || !each.link) continue %>
<div class="card col-lg-4 col-md-6 col-sm-12">
<a href="<%= url_for(each.link) %>" class="card-body hover-with-bg" target="_blank" rel="noopener">
<a href="<%= url_for(each.link) %>" class="card-body hover-with-bg" target="_blank" rel="noopener" aria-label="<%= `访问 ${each.title}` %>">
<div class="card-content">
<% if (each.avatar || each.image) { %>
<div class="link-avatar my-auto">
<img src="<%= url_for(each.avatar || each.image) %>" alt="<%= each.title %>"
loading="lazy"
onerror="this.onerror=null; this.src=this.srcset='<%= url_for(theme.links.onerror_avatar) %>'"/>
</div>
<% } %>
Expand All @@ -30,6 +31,37 @@ page.comment = theme.links.comments.type
<% } %>
</div>

<% if (theme.links.inactive && theme.links.inactive.enable && theme.links.inactive.inactiveItems) { %>
<hr/>
<% if (theme.links.inactive.label) { %>
<p class="inactive-label"><%- theme.links.inactive.label %></p>
<% } %>

<div class="row links">
<% for(const item of theme.links.inactive.inactiveItems || []) { %>
<% if (!item.title || !item.link) continue %>
<div class="card col-lg-4 col-md-6 col-sm-12">
<a href="<%= url_for(item.link) %>" class="card-body hover-with-bg" target="_blank" rel="noopener" aria-label="<%= `访问 ${item.title}` %>">
<div class="card-content">
<% if (item.avatar || item.image) { %>
<div class="link-avatar my-auto">
<img src="<%= url_for(item.avatar || item.image) %>" alt="<%= item.title %>"
loading="lazy"
onerror="this.onerror=null; this.src=this.srcset='<%= url_for(theme.links.onerror_avatar) %>'"/>
</div>
<% } %>
<div class="link-text">
<div class="link-title"><%- item.title %></div>
<div class="link-intro"><%- item.intro || '' %></div>
</div>
</div>
</a>
</div>
<% } %>
</div>
<% } %>


<% if(theme.links.custom && theme.links.custom.enable && theme.links.custom.content) { %>
<!-- Custom -->
<div class="custom mx-auto">
Expand Down
Loading