feat(图标): 添加本地SVG图标支持并更新相关配置

- 在astro配置中添加iconDir指定本地图标目录
- 移除@iconify-json/simple-icons生产依赖,改为开发依赖
- 添加多个本地SVG图标文件(creative-commons, qq, telegram等)
- 更新配置文件使用本地图标替代Font Awesome图标
- 在Profile组件中添加文章数和字数统计功能
This commit is contained in:
二叉树树
2026-01-22 01:01:56 +08:00
parent 086e16a56d
commit 9f5932622c
12 changed files with 53 additions and 15 deletions

View File

@@ -54,7 +54,7 @@ const postUrl = decodeURIComponent(Astro.url.toString());
<a href={licenseConf.url} target="_blank" class="link text-[var(--primary)] line-clamp-2">{licenseConf.name}</a>
</div>
</div>
<Icon name="fa6-brands:creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
<Icon name="creative-commons" class="transition text-[15rem] absolute pointer-events-none right-6 top-1/2 -translate-y-1/2 text-black/5 dark:text-white/5"></Icon>
</div>

View File

@@ -1,8 +1,19 @@
---
import { Icon } from "astro-icon/components";
import { profileConfig, siteConfig, umamiConfig } from "../../config";
import { getSortedPosts } from "@utils/content-utils";
const config = profileConfig;
const posts = await getSortedPosts();
const totalPosts = posts.length;
let totalWords = 0;
for (const post of posts) {
const { remarkPluginFrontmatter } = await post.render();
if (remarkPluginFrontmatter && remarkPluginFrontmatter.words) {
totalWords += remarkPluginFrontmatter.words;
}
}
---
<div class="card-base p-3 border border-black/10 dark:border-white/10">
<div class="relative mx-auto mt-1 lg:mx-0 lg:mt-0 mb-3 max-w-[12rem] lg:max-w-none rounded-xl overflow-hidden" style={`--theme-hue: ${siteConfig.themeColor.hue}`}>
@@ -25,6 +36,26 @@ const config = profileConfig;
</a>}
</div>
<!-- 全站文章与字数统计 -->
<div class="grid grid-cols-2 mt-3 pt-3 border-t border-neutral-300 dark:border-neutral-700">
<div class="text-center">
<div class="text-xs text-neutral-500 mb-1 flex items-center justify-center gap-1">
<Icon name="material-symbols:article-outline" class="text-base"></Icon>
<span class="text-xs">文章数</span>
</div>
<div class="font-bold text-lg text-neutral-700 dark:text-neutral-300">{totalPosts}</div>
</div>
<div class="text-center border-l border-neutral-300 dark:border-neutral-700">
<div class="text-xs text-neutral-500 mb-1 flex items-center justify-center gap-1">
<Icon name="material-symbols:format-list-numbered" class="text-base"></Icon>
<span class="text-xs">总字数</span>
</div>
<div class="font-bold text-lg text-neutral-700 dark:text-neutral-300">
{(totalWords / 10000).toFixed(1)}w
</div>
</div>
</div>
<!-- 全站访问量统计 -->
<div class="grid grid-cols-2 mt-3 pt-3 border-t border-neutral-300 dark:border-neutral-700">
<div class="text-center">

View File

@@ -101,28 +101,28 @@ export const profileConfig: ProfileConfig = {
links: [
{
name: "QQ",
icon: "fa6-brands:qq",
icon: "qq", // Local icon
url: "https://qm.qq.com/q/FWqOHlwL2m",
},
{
name: "Telegram",
icon: "fa6-brands:telegram",
icon: "telegram", // Local icon
url: "https://t.me/+_07DERp7k1ljYTc1",
},
{
name: "Bilibli",
icon: "fa6-brands:bilibili",
icon: "bilibili", // Local icon
url: "https://space.bilibili.com/325903362",
},
{
name: "Folo",
icon: "fa6-brands:folo",
url: "https://app.folo.is/share/feeds/236818461447222272",
name: "GitHub",
icon: "github", // Local icon
url: "https://github.com/afoim",
},
{
name: "GitHub",
icon: "fa6-brands:github",
url: "https://github.com/afoim",
name: "Folo",
icon: "folo", // Local icon
url: "https://app.folo.is/share/feeds/236818461447222272",
},
],
};