diff --git a/.astro/content.d.ts b/.astro/content.d.ts
index 2e24b88..5772d5a 100644
--- a/.astro/content.d.ts
+++ b/.astro/content.d.ts
@@ -214,6 +214,6 @@ declare module 'astro:content' {
LiveContentConfig['collections'][C]['loader']
>;
- export type ContentConfig = typeof import("./../src/content/config.js");
+ export type ContentConfig = typeof import("../src/content/config.js");
export type LiveContentConfig = never;
}
diff --git a/package.json b/package.json
index 109cc73..71c5b32 100644
--- a/package.json
+++ b/package.json
@@ -33,6 +33,7 @@
"@iconify/svelte": "^4.2.0",
"@swup/astro": "^1.7.0",
"@tailwindcss/typography": "^0.5.19",
+ "@vercel/analytics": "^1.6.1",
"@vercel/speed-insights": "^1.3.1",
"astro": "5.13.10",
"astro-expressive-code": "^0.41.4",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 90207ce..3dc7785 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -59,6 +59,9 @@ importers:
'@tailwindcss/typography':
specifier: ^0.5.19
version: 0.5.19(tailwindcss@3.4.19(yaml@2.8.2))
+ '@vercel/analytics':
+ specifier: ^1.6.1
+ version: 1.6.1(svelte@5.39.8)
'@vercel/speed-insights':
specifier: ^1.3.1
version: 1.3.1(svelte@5.39.8)
@@ -2122,6 +2125,32 @@ packages:
'@ungap/structured-clone@1.3.0':
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
+ '@vercel/analytics@1.6.1':
+ resolution: {integrity: sha512-oH9He/bEM+6oKlv3chWuOOcp8Y6fo6/PSro8hEkgCW3pu9/OiCXiUpRUogDh3Fs3LH2sosDrx8CxeOLBEE+afg==}
+ peerDependencies:
+ '@remix-run/react': ^2
+ '@sveltejs/kit': ^1 || ^2
+ next: '>= 13'
+ react: ^18 || ^19 || ^19.0.0-rc
+ svelte: '>= 4'
+ vue: ^3
+ vue-router: ^4
+ peerDependenciesMeta:
+ '@remix-run/react':
+ optional: true
+ '@sveltejs/kit':
+ optional: true
+ next:
+ optional: true
+ react:
+ optional: true
+ svelte:
+ optional: true
+ vue:
+ optional: true
+ vue-router:
+ optional: true
+
'@vercel/speed-insights@1.3.1':
resolution: {integrity: sha512-PbEr7FrMkUrGYvlcLHGkXdCkxnylCWePx7lPxxq36DNdfo9mcUjLOmqOyPDHAOgnfqgGGdmE3XI9L/4+5fr+vQ==}
peerDependencies:
@@ -7629,6 +7658,10 @@ snapshots:
'@ungap/structured-clone@1.3.0': {}
+ '@vercel/analytics@1.6.1(svelte@5.39.8)':
+ optionalDependencies:
+ svelte: 5.39.8
+
'@vercel/speed-insights@1.3.1(svelte@5.39.8)':
optionalDependencies:
svelte: 5.39.8
diff --git a/src/components/Footer.astro b/src/components/Footer.astro
index 55dd829..5ada5e3 100644
--- a/src/components/Footer.astro
+++ b/src/components/Footer.astro
@@ -1,5 +1,6 @@
---
import { profileConfig } from "../config";
+
const currentYear = new Date().getFullYear();
---
diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro
index 04dee21..984ea04 100644
--- a/src/components/Navbar.astro
+++ b/src/components/Navbar.astro
@@ -12,12 +12,12 @@ import NavMenuPanel from "./widget/NavMenuPanel.astro";
const className = Astro.props.class;
let links: NavBarLink[] = navBarConfig.links.map(
- (item: NavBarLink | LinkPreset): NavBarLink => {
- if (typeof item === "number") {
- return LinkPresets[item];
- }
- return item;
- },
+ (item: NavBarLink | LinkPreset): NavBarLink => {
+ if (typeof item === "number") {
+ return LinkPresets[item];
+ }
+ return item;
+ },
);
---
diff --git a/src/components/widget/SideBar.astro b/src/components/widget/SideBar.astro
index 6e64546..0770a63 100644
--- a/src/components/widget/SideBar.astro
+++ b/src/components/widget/SideBar.astro
@@ -7,8 +7,8 @@ import Profile from "./Profile.astro";
import Statistics from "./Statistics.astro"; // 统计组件
interface Props {
- class?: string;
- headings?: MarkdownHeading[];
+ class?: string;
+ headings?: MarkdownHeading[];
}
const className = Astro.props.class;
diff --git a/src/components/widget/Statistics.astro b/src/components/widget/Statistics.astro
index 136c5ac..46cfc56 100644
--- a/src/components/widget/Statistics.astro
+++ b/src/components/widget/Statistics.astro
@@ -1,6 +1,6 @@
---
-import WidgetLayout from "./WidgetLayout.astro";
import { Icon } from "astro-icon/components";
+import WidgetLayout from "./WidgetLayout.astro";
---
diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro
index 4b7f179..8c8f558 100644
--- a/src/layouts/Layout.astro
+++ b/src/layouts/Layout.astro
@@ -71,6 +71,7 @@ const bannerOffsetByPosition = {
const bannerOffset =
bannerOffsetByPosition[siteConfig.banner.position || "center"];
+import Analytics from "@vercel/analytics/astro";
// vercel 速度洞察
import SpeedInsights from "@vercel/speed-insights/astro";
---
@@ -192,6 +193,8 @@ import SpeedInsights from "@vercel/speed-insights/astro";
title={profileConfig.name}
href={`${Astro.site}rss.xml`}
/>
+
+
diff --git a/src/pages/friends/index.astro b/src/pages/friends/index.astro
index 0ae96cf..5b6dbc9 100644
--- a/src/pages/friends/index.astro
+++ b/src/pages/friends/index.astro
@@ -1,12 +1,11 @@
---
-import { i18n } from "../../i18n/translation";
-import I18nKey from "../../i18n/i18nKey";
-import MainGridLayout from "../../layouts/MainGridLayout.astro";
-import FriendCard from "../../components/FriendCard.astro";
-import friendsData from "../../data/friends.json";
-
// 评论组件
import Comment from "../../components/Comment.astro";
+import FriendCard from "../../components/FriendCard.astro";
+import friendsData from "../../data/friends.json";
+import I18nKey from "../../i18n/i18nKey";
+import { i18n } from "../../i18n/translation";
+import MainGridLayout from "../../layouts/MainGridLayout.astro";
---
diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro
index 6aeaf23..2a13d23 100644
--- a/src/pages/posts/[...slug].astro
+++ b/src/pages/posts/[...slug].astro
@@ -15,11 +15,11 @@ import { profileConfig, siteConfig } from "../../config";
import { formatDateToYYYYMMDD } from "../../utils/date-utils";
export async function getStaticPaths() {
- const blogEntries = await getSortedPosts();
- return blogEntries.map((entry) => ({
- params: { slug: entry.slug },
- props: { entry },
- }));
+ const blogEntries = await getSortedPosts();
+ return blogEntries.map((entry) => ({
+ params: { slug: entry.slug },
+ props: { entry },
+ }));
}
const { entry } = Astro.props;
@@ -28,21 +28,21 @@ const { Content, headings } = await entry.render();
const { remarkPluginFrontmatter } = await entry.render();
const jsonLd = {
- "@context": "https://schema.org",
- "@type": "BlogPosting",
- headline: entry.data.title,
- description: entry.data.description || entry.data.title,
- keywords: entry.data.tags,
- author: {
- "@type": "Person",
- name: profileConfig.name,
- url: Astro.site,
- },
- datePublished: formatDateToYYYYMMDD(entry.data.published),
- inLanguage: entry.data.lang
- ? entry.data.lang.replace("_", "-")
- : siteConfig.lang.replace("_", "-"),
- // TODO include cover image here
+ "@context": "https://schema.org",
+ "@type": "BlogPosting",
+ headline: entry.data.title,
+ description: entry.data.description || entry.data.title,
+ keywords: entry.data.tags,
+ author: {
+ "@type": "Person",
+ name: profileConfig.name,
+ url: Astro.site,
+ },
+ datePublished: formatDateToYYYYMMDD(entry.data.published),
+ inLanguage: entry.data.lang
+ ? entry.data.lang.replace("_", "-")
+ : siteConfig.lang.replace("_", "-"),
+ // TODO include cover image here
};
// 评论组件
diff --git a/src/pages/ss/index.astro b/src/pages/ss/index.astro
index e55350a..371b8f1 100644
--- a/src/pages/ss/index.astro
+++ b/src/pages/ss/index.astro
@@ -1,24 +1,24 @@
---
-import MainGridLayout from "../../layouts/MainGridLayout.astro";
import ssData from "../../data/ss.json";
+import MainGridLayout from "../../layouts/MainGridLayout.astro";
// 精准时间转换函数
function getRelativeTime(dateString: string) {
- const now = new Date();
- const past = new Date(dateString);
- const diffInMs = now.getTime() - past.getTime();
- const diffInSecs = Math.floor(diffInMs / 1000);
- const diffInMins = Math.floor(diffInSecs / 60);
- const diffInHours = Math.floor(diffInMins / 60);
- const diffInDays = Math.floor(diffInHours / 24);
-
- if (diffInSecs < 60) return "刚刚";
- if (diffInMins < 60) return `${diffInMins}分钟前`;
- if (diffInHours < 24) return `${diffInHours}小时前`;
- if (diffInDays === 1) return "昨天";
- if (diffInDays === 2) return "前天";
- if (diffInDays < 7) return `${diffInDays}天前`;
- return dateString; // 超过一周显示原日期
+ const now = new Date();
+ const past = new Date(dateString);
+ const diffInMs = now.getTime() - past.getTime();
+ const diffInSecs = Math.floor(diffInMs / 1000);
+ const diffInMins = Math.floor(diffInSecs / 60);
+ const diffInHours = Math.floor(diffInMins / 60);
+ const diffInDays = Math.floor(diffInHours / 24);
+
+ if (diffInSecs < 60) return "刚刚";
+ if (diffInMins < 60) return `${diffInMins}分钟前`;
+ if (diffInHours < 24) return `${diffInHours}小时前`;
+ if (diffInDays === 1) return "昨天";
+ if (diffInDays === 2) return "前天";
+ if (diffInDays < 7) return `${diffInDays}天前`;
+ return dateString; // 超过一周显示原日期
}
// 评论组件