82 lines
2.2 KiB
TypeScript
82 lines
2.2 KiB
TypeScript
import type { FriendLink, FriendsPageConfig } from "../types/friendsConfig";
|
|
|
|
// 可以在src/content/spec/friends.md中编写友链页面下方的自定义内容
|
|
|
|
// 友链页面配置
|
|
export const friendsPageConfig: FriendsPageConfig = {
|
|
// 页面标题,如果留空则使用 i18n 中的翻译
|
|
title: "",
|
|
|
|
// 页面描述文本,如果留空则使用 i18n 中的翻译
|
|
description: "",
|
|
|
|
// 是否显示底部自定义内容(friends.mdx 中的内容)
|
|
showCustomContent: true,
|
|
|
|
// 是否显示评论区,需要先在commentConfig.ts启用评论系统
|
|
showComment: false,
|
|
|
|
// 是否开启随机排序配置,如果开启,就会忽略权重,构建时进行一次随机排序
|
|
randomizeSort: false,
|
|
};
|
|
|
|
// 友链配置
|
|
export const friendsConfig: FriendLink[] = [
|
|
{
|
|
title: "狼与凤梨田",
|
|
imgurl: "https://avatars.githubusercontent.com/u/91077200?v=4",
|
|
desc: "初雪 · 冰",
|
|
siteurl: "https://wolf.snowlyicewolf.club/",
|
|
tags: ["博客"],
|
|
weight: 10, // 权重,数字越大排序越靠前
|
|
enabled: true, // 是否启用
|
|
},
|
|
{
|
|
title: "TheWind's Blog",
|
|
imgurl: "https://q.qlogo.cn/headimg_dl?dst_uin=2011332114&spec=640&img_type=png",
|
|
desc: "The Wind",
|
|
siteurl: "https://blog.thewinds.top/",
|
|
tags: ["博客"],
|
|
weight: 9,
|
|
enabled: false,
|
|
},
|
|
{
|
|
title: "绀漓の锟斤拷",
|
|
imgurl: "https://avatars.githubusercontent.com/u/89193494?v=4",
|
|
desc: "锟斤拷烫烫烫",
|
|
siteurl: "https://blog.sevtinge.com/",
|
|
tags: ["博客"],
|
|
weight: 8,
|
|
enabled: true,
|
|
},
|
|
{
|
|
title: "夜白的小空间",
|
|
imgurl: "/avatars/yebai.jpg",
|
|
desc: "Live Today,Love Tomorrow,Unite Forever.",
|
|
siteurl: "https://blog.yebaiwn.top",
|
|
tags: ["博客"],
|
|
weight: 7,
|
|
enabled: true,
|
|
},
|
|
{
|
|
title: "毛窝",
|
|
imgurl: "https://maowo.space/wp-content/uploads/2026/09/512x_2.avif",
|
|
desc: "发现毛毛们在互联网上的小角落",
|
|
siteurl: "https://maowo.space/",
|
|
tags: ["博客聚合"],
|
|
weight: 1,
|
|
enabled: true,
|
|
},
|
|
];
|
|
|
|
// 获取启用的友链并进行排序
|
|
export const getEnabledFriends = (): FriendLink[] => {
|
|
const friends = friendsConfig.filter((friend) => friend.enabled);
|
|
|
|
if (friendsPageConfig.randomizeSort) {
|
|
return friends.sort(() => Math.random() - 0.5);
|
|
}
|
|
|
|
return friends.sort((a, b) => b.weight - a.weight);
|
|
};
|