diff --git a/public/sotr.jpg b/public/sotr.jpg new file mode 100644 index 0000000..3b6b1a7 Binary files /dev/null and b/public/sotr.jpg differ diff --git a/src/components/Footer.astro b/src/components/Footer.astro index fe39b38..bb5948c 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -17,5 +17,7 @@ const currentYear = new Date().getFullYear(); Powered by Astro & Fuwari + / + Sotr's Blog \ No newline at end of file diff --git a/src/components/widget/FriendShip.astro b/src/components/widget/FriendShip.astro new file mode 100644 index 0000000..1432c64 --- /dev/null +++ b/src/components/widget/FriendShip.astro @@ -0,0 +1,27 @@ +--- +import { Image } from "astro:assets"; +import I18nKey from "../../i18n/i18nKey"; +import { i18n } from "../../i18n/translation"; +import WidgetLayout from "./WidgetLayout.astro"; +import ButtonTag from "@components/control/ButtonTag.astro"; +import type { SiteConfig } from "../../types/config"; +import { siteConfig } from "@/config"; + +const COLLAPSED_HEIGHT = "7.5rem"; +const className = Astro.props.class; +const style = Astro.props.style; + +const FRIENDS = siteConfig.friendsConfig?.items || []; +const FRIENDS_ENABLED = siteConfig.friendsConfig?.enable || false; +--- +{FRIENDS_ENABLED && ( + +
+ {FRIENDS.map((friend) => ( + + {friend.imgAlt{friend.name} + + ))} +
+
+)} \ No newline at end of file diff --git a/src/components/widget/SideBar.astro b/src/components/widget/SideBar.astro index f3bafc2..96bbef3 100644 --- a/src/components/widget/SideBar.astro +++ b/src/components/widget/SideBar.astro @@ -3,6 +3,8 @@ import type { MarkdownHeading } from "astro"; import Categories from "./Categories.astro"; import Profile from "./Profile.astro"; import Tag from "./Tags.astro"; +import FriendShip from "./FriendShip.astro"; + interface Props { class?: string; @@ -18,5 +20,6 @@ const className = Astro.props.class; diff --git a/src/config.ts b/src/config.ts index 8b57225..a0d5904 100644 --- a/src/config.ts +++ b/src/config.ts @@ -29,6 +29,15 @@ export const siteConfig: SiteConfig = { enable: true, // Display the table of contents on the right side of the post depth: 3, // Maximum heading depth to show in the table, from 1 to 3 }, + friendsConfig: { + enable: true, + items: [{ + name: "Sotr's Blog", + url: "https://kira.moe", + imgSrc: "/sotr.jpg", + imgAlt: "Sotr's Blog", + },], + }, favicon: [ // Leave this array empty to use the default favicon // { diff --git a/src/i18n/i18nKey.ts b/src/i18n/i18nKey.ts index d5834b6..cd05233 100644 --- a/src/i18n/i18nKey.ts +++ b/src/i18n/i18nKey.ts @@ -5,6 +5,7 @@ enum I18nKey { search = "search", download = "download", + friendship = "friendship", tags = "tags", categories = "categories", recentPosts = "recentPosts", diff --git a/src/i18n/languages/zh_CN.ts b/src/i18n/languages/zh_CN.ts index 7542087..763cc25 100644 --- a/src/i18n/languages/zh_CN.ts +++ b/src/i18n/languages/zh_CN.ts @@ -8,6 +8,7 @@ export const zh_CN: Translation = { [Key.search]: "搜索", [Key.download]: "下载", + [Key.friendship]: "友情链接", [Key.tags]: "标签", [Key.categories]: "分类", [Key.recentPosts]: "最新文章", diff --git a/src/types/config.ts b/src/types/config.ts index f6795bc..74326ff 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -34,7 +34,7 @@ export type SiteConfig = { enable: boolean; depth: 1 | 2 | 3; }; - + friendsConfig?: FriendsConfig; favicon: Favicon[]; }; @@ -44,6 +44,18 @@ export type Favicon = { sizes?: string; }; +export type FriendItem = { + name: string; + url: string; + imgSrc?: string; + imgAlt?: string; +}; + +export type FriendsConfig = { + enable: boolean; + items: FriendItem[]; +}; + export enum LinkPreset { Home = 0, Archive = 1,