Skip to content

Commit 364a541

Browse files
author
zhihao
committed
feat: 添加网站图标和logo,更新头部组件以使用新logo
1 parent b9f0dcf commit 364a541

File tree

6 files changed

+15
-5
lines changed

6 files changed

+15
-5
lines changed

public/favicon.ico

16.6 KB
Binary file not shown.

public/logo.png

14.7 KB
Loading

src/components/Head.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ const { title, description, image = "/nano.png" } = Astro.props;
2424
<!-- Global Metadata -->
2525
<meta charset="utf-8" />
2626
<meta name="viewport" content="width=device-width,initial-scale=1" />
27-
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon-dark.svg`} media="(prefers-color-scheme: dark)">
28-
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon-light.svg`} media="(prefers-color-scheme: light)">
29-
<link rel="icon" type="image/x-icon" href={`${import.meta.env.BASE_URL}/favicon-light.svg`}>
27+
<!-- <link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon-dark.svg`} media="(prefers-color-scheme: dark)">
28+
<link rel="icon" type="image/svg+xml" href={`${import.meta.env.BASE_URL}/favicon-light.svg`} media="(prefers-color-scheme: light)"> -->
29+
<link rel="icon" type="image/x-icon" href={`${import.meta.env.BASE_URL}/favicon.ico`}>
3030
<meta name="generator" content={Astro.generator} />
3131

3232
<!-- Font preloads -->

src/components/Header.astro

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ import { SITE, ROUTERS, WEBSITE_PATHNAME } from "@consts";
88
<Container>
99
<div class="flex flex-wrap gap-y-2 justify-between">
1010
<Link href={WEBSITE_PATHNAME.HOME} underline={false}>
11-
<div class="font-semibold">
11+
<img
12+
src={SITE.LOGO}
13+
alt={SITE.NAME}
14+
class="w-4 h-4 inline-block"
15+
loading="lazy"
16+
width="16"
17+
height="16"
18+
/>
19+
<span class="font-semibold leading-none">
1220
{SITE.NAME}
13-
</div>
21+
</span>
1422
</Link>
1523
<nav class="flex gap-1">
1624
{

src/consts.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const SITE: Site = {
66
NUM_POSTS_ON_HOMEPAGE: 3,
77
NUM_WORKS_ON_HOMEPAGE: 2,
88
NUM_PROJECTS_ON_HOMEPAGE: 3,
9+
LOGO: "/blog/logo.png",
910
};
1011

1112
export enum PAGE_KEY {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export type Site = {
44
NUM_POSTS_ON_HOMEPAGE: number;
55
NUM_WORKS_ON_HOMEPAGE: number;
66
NUM_PROJECTS_ON_HOMEPAGE: number;
7+
LOGO: string;
78
};
89

910
export type Metadata = {

0 commit comments

Comments
 (0)