Skip to content

Commit 4144185

Browse files
committed
完整 SEO 优化:sitemap、robots、结构化数据、站长验证
- 添加 jekyll-seo-tag 和 jekyll-sitemap 插件 - 在 head.html 注入 {% seo %} 标签和 canonical 链接 - 创建 robots.txt 指明 sitemap 位置 - 更新 _config.yml 添加 SEO 配置 - 创建站点 logo (K字母设计) - 更新 Gemfile 添加 SEO 插件依赖
1 parent a46c57b commit 4144185

File tree

7 files changed

+123192
-25123
lines changed

7 files changed

+123192
-25123
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ gem "minima", "~> 2.5"
66
group :jekyll_plugins do
77
gem "jekyll-feed", "~> 0.17"
88
gem "jekyll-paginate", "~> 1.1"
9+
gem "jekyll-seo-tag", "~> 2.8"
10+
gem "jekyll-sitemap", "~> 1.4"
911
end
1012

1113
# Allow running `bundle exec jekyll serve` on Ruby >= 3.0

_config.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
1-
title: Kaermaxc Blog
2-
description: >-
3-
分享日常开发、创意与学习笔记的个人博客。
1+
title: "Kaermaxc Blog - 日复一日"
2+
description: "记录开发实践与思考:Neovim、C/C++、Jekyll、电机控制与自动化。分享日常开发、创意与学习笔记。"
43
lang: zh-CN
54
url: https://magic-alt.github.io
65
baseurl: ""
76
theme: minima
87
author:
98
name: Kaermaxc
109
email: you@example.com
10+
url: https://magic-alt.github.io
1111
timezone: Asia/Shanghai
1212

13+
# 站点 Logo(用于 SEO 与社交分享)
14+
logo: /assets/images/logo.svg
15+
16+
# Twitter / X 账号(可选,去掉 @)
17+
twitter:
18+
username: magic_alt
19+
1320
permalink: /:categories/:title/
1421

1522
paginate: 5
1623
paginate_path: "/page:num/"
1724

25+
# SEO 与站长验证
1826
plugins:
1927
- jekyll-feed
2028
- jekyll-paginate
29+
- jekyll-seo-tag # 自动注入 SEO 元信息与结构化数据
30+
- jekyll-sitemap # 自动生成 /sitemap.xml
31+
32+
# 站长验证(填入验证码)
33+
webmaster_verifications:
34+
google: "" # Google Search Console 验证码
35+
bing: "" # Bing Webmaster Tools 验证码
2136

2237
mathjax: true
2338

_includes/head.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@
44
<meta charset="utf-8">
55
<meta http-equiv="X-UA-Compatible" content="IE=edge">
66
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<title>{% if page.title %}{{ page.title }} · {% endif %}{{ site.title }}</title>
8-
<meta name="description" content="{{ page.excerpt | default: site.description | strip_html | strip_newlines }}">
7+
8+
<!-- SEO 标签:自动生成 title, description, OG, Twitter Card, JSON-LD 等 -->
9+
{% seo %}
10+
11+
<!-- Canonical URL -->
12+
<link rel="canonical" href="{{ page.url | absolute_url }}">
13+
914
<meta name="theme-color" content="#0f172a">
10-
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | relative_url }}">
15+
<link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ "/feed.xml" | absolute_url }}">
1116
<link rel="stylesheet" href="{{ "/assets/css/styles.css" | relative_url }}">
1217

1318
<!-- MathJax Configuration -->
-114 KB
Loading

assets/images/about-me-portrait.svg

Lines changed: 123129 additions & 25117 deletions
Loading

assets/images/logo.svg

Lines changed: 27 additions & 0 deletions
Loading

robots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
User-agent: *
2+
Allow: /
3+
4+
# Sitemap 位置
5+
Sitemap: https://magic-alt.github.io/sitemap.xml
6+
7+
# 禁止抓取的目录(可选)
8+
Disallow: /assets/

0 commit comments

Comments
 (0)