Skip to content

Commit a985712

Browse files
committed
修复 seo
1 parent 7ad2b26 commit a985712

File tree

6 files changed

+48
-28
lines changed

6 files changed

+48
-28
lines changed

src/layouts/BaseLayout.astro

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,55 @@ import "../styles/global.css";
44
import { ClientRouter } from "astro:transitions";
55
import gopherImage from "../assets/pilot-bust.svg";
66
import { Image } from "astro:assets";
7-
const { description, keywords ,selected} = Astro.props;
7+
const { description, keywords, selected } = Astro.props;
88
---
99

1010
<html lang="zh">
1111
<head>
1212
<meta charset="utf-8" />
1313
<link rel="icon" href="/favicon.svg" type="image/svg" />
1414
<link rel="sitemap" href="/sitemap-index.xml" />
15-
<script src="../scripts/swUnregister.ts"/>
15+
<script src="../scripts/swUnregister.ts"></script>
1616
<ClientRouter />
1717
<meta name="viewport" content="width=device-width, initial-scale=1" />
1818
<meta name="description" content={description} />
1919
<meta name="keywords" content={keywords} />
2020
<meta name="author" content="LingLambda" />
2121
<!-- 统一不同浏览器的默认样式 -->
22-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
22+
<link
23+
rel="stylesheet"
24+
href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css"
25+
integrity="sha512-NhSC1YmyruXifcj/KFRWoC561YpHpc5Jtzgvbuzx5VozKpWvQ+4nXhPdFgmx8xqexRcpAglTj9sIBWINXa8x5w=="
26+
crossorigin="anonymous"
27+
referrerpolicy="no-referrer"
28+
/>
2329
<title>Ling的小窝</title>
2430
</head>
2531
<body>
2632
<div id="container">
2733
<header id="menu">
28-
<HeadMenu/>
34+
<HeadMenu />
2935
</header>
30-
<slot />
36+
<slot>暂时还没有内容哦</slot>
3137
<!-- <hr style="width:600px;color:#808080; margin-top: 1rem;" /> -->
3238
<footer>
33-
<Image class="gopher" src={gopherImage} height=32 alt="gopher" title="这个博客和 Golang 没有任何关系,但是土拨鼠很可爱" loading="eager"/>
39+
<Image
40+
class="gopher"
41+
src={gopherImage}
42+
height="32"
43+
alt="gopher"
44+
title="这个博客和 Golang 没有任何关系,但是土拨鼠很可爱"
45+
loading="eager"
46+
/>
3447
<!-- <Image src={notByAi} alt="not-by-ai" /> -->
3548
<p>&copy; 2024-2025</p>
3649
<p>LingLambda</p>
3750
<p>
38-
<a href="https://icp.gov.moe/?keyword=20251154" target="_blank" class="footer-link">萌ICP备20251154号</a>
51+
<a
52+
href="https://icp.gov.moe/?keyword=20251154"
53+
target="_blank"
54+
class="footer-link">萌ICP备20251154号</a
55+
>
3956
</p>
4057
<p>
4158
本站使用 <a href="https://astro.build" class="footer-link">Astro</a> 编写
@@ -49,11 +66,15 @@ const { description, keywords ,selected} = Astro.props;
4966
const menu = document.getElementById("menu");
5067
if (menu instanceof HTMLElement) {
5168
let lastScrollTop = 0;
52-
addEventListener("scroll", () => {
53-
const scrollTop = window.scrollY;
54-
menu.style.top = scrollTop > lastScrollTop ? "-5.5rem" : "0.2rem";
55-
lastScrollTop = scrollTop;
56-
}, { passive: true });
69+
addEventListener(
70+
"scroll",
71+
() => {
72+
const scrollTop = window.scrollY;
73+
menu.style.top = scrollTop > lastScrollTop ? "-5.5rem" : "0.2rem";
74+
lastScrollTop = scrollTop;
75+
},
76+
{ passive: true }
77+
);
5778
}
5879
</script>
5980

@@ -65,7 +86,7 @@ const { description, keywords ,selected} = Astro.props;
6586
html {
6687
background-color: rgb(250, 252, 254);
6788
/* scrollbar-gutter: stable; */ /* 防止滚动条导致页面宽度不一致 */
68-
overflow-y: scroll; /*总是显示滚动条*/
89+
overflow-y: scroll; /*总是显示滚动条*/
6990
}
7091

7192
html,
@@ -127,8 +148,8 @@ const { description, keywords ,selected} = Astro.props;
127148
img {
128149
max-width: 36rem;
129150
}
130-
131-
.gopher{
151+
152+
.gopher {
132153
align-self: flex-end;
133154
}
134155
</style>

src/layouts/BlogLayout.astro

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
import BaseLayout from "./BaseLayout.astro";
3+
const { description, keywords } = Astro.props;
34
---
45

5-
<BaseLayout>
6+
<BaseLayout description={description} keywords={keywords}>
67
<section>
7-
<slot />
8+
<slot>暂时还没有内容哦</slot>
89
</section>
910
</BaseLayout>
1011

@@ -13,6 +14,6 @@ import BaseLayout from "./BaseLayout.astro";
1314
max-width: 65ch;
1415
padding: 0;
1516
/* padding:8% */
16-
width: 85%
17+
width: 85%;
1718
}
1819
</style>

src/layouts/FriendsLayout.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
import MainLayout from "./MainLayout.astro";
33
---
44

5-
<MainLayout>
5+
<MainLayout description="本页面供奉着我的朋友们(不是" keywords="friends,links">
66
<div id="cards">
77
<slot>暂时还没有内容哦</slot>
88
</div>
9-
9+
1010
<div id="info">
1111
<p>前辈!和我交换友链吧!</p>
1212
<p>
@@ -25,7 +25,7 @@ import MainLayout from "./MainLayout.astro";
2525
</MainLayout>
2626

2727
<style>
28-
#info{
28+
#info {
2929
padding: 20px 50px;
3030
}
3131
#cards {

src/layouts/MainLayout.astro

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
import BaseLayout from "./BaseLayout.astro";
3+
const { description, keywords } = Astro.props;
34
---
45

5-
<BaseLayout>
6+
<BaseLayout description={description} keywords={keywords}>
67
<main>
78
<slot />
89
</main>
@@ -14,6 +15,6 @@ import BaseLayout from "./BaseLayout.astro";
1415
flex-grow: 1; /* 使 main 占据剩余空间 */
1516
font-size: 1rem;
1617
line-height: 1.75;
17-
width: 85%
18+
width: 85%;
1819
}
1920
</style>

src/pages/friend-links.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import friends from "../../public/assets/friends.json";
55
friends.sort(() => Math.random() - 0.5);
66
---
77

8-
<FriendsLayout
9-
description="本页面供奉着我的朋友们(不是"
10-
keywords="friends,links"
11-
>
8+
<FriendsLayout>
129
{
1310
friends.map(({ name, des, icon, url }) => (
1411
<a class="main" href={url}>

src/pages/lab.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const links = [
1313
];
1414
---
1515

16-
<BaseLayout description="偶尔会在这乱写" keywords="lab,实验,前端">
16+
<BaseLayout description="我的前端实验室,偶尔会在这乱写" keywords="lab,实验,前端">
1717
<main>
1818
偶尔会在这乱写
1919
<div id="tac-say">

0 commit comments

Comments
 (0)