更新于 

SEO优化

SEO 优化

让搜索引擎更好地收录你的博客,获得更多自然流量。

基础 SEO 配置

站点描述

_config.yml 中配置:

1
2
3
4
5
6
7
title: My Blog
description: 一个关于技术与生活的个人博客
keywords:
- 博客
- 技术
- 编程
author: Your Name

文章 SEO

每篇文章都应该有良好的 Front Matter:

1
2
3
4
5
6
---
title: Hexo博客搭建教程
description: 从零开始搭建Hexo博客的完整教程
keywords: [Hexo, 博客, 教程]
date: 2024-01-01 10:00:00
---

Sitemap

安装 sitemap 插件:

1
npm install hexo-generator-sitemap

_config.yml 中配置:

1
2
3
sitemap:
path: sitemap.xml
rel: false

robots.txt

source/ 目录下创建 robots.txt

1
2
3
4
5
6
7
User-agent: *
Allow: /
Disallow: /js/
Disallow: /css/
Disallow: /images/

Sitemap: https://your-domain.com/sitemap.xml

提交搜索引擎

Google

  1. 访问 Google Search Console
  2. 添加你的站点
  3. 验证站点所有权
  4. 提交 sitemap:https://your-domain.com/sitemap.xml

百度

  1. 访问 百度搜索资源平台
  2. 添加站点
  3. 验证所有权
  4. 提交 sitemap

Bing

  1. 访问 Bing Webmaster Tools
  2. 添加站点
  3. 提交 sitemap

文章优化技巧

标题优化

  • 使用 H1 作为文章标题(Front Matter 中的 title)
  • 正文使用 H2、H3 层级
  • 标题包含关键词

内容优化

  • 文章开头包含核心关键词
  • 使用内部链接连接相关文章
  • 添加 alt 属性描述图片
  • 保持文章结构清晰

图片优化

  • 使用描述性文件名(hexo-tutorial.jpg 而不是 img001.jpg
  • 添加 alt 属性
  • 压缩图片大小

性能优化

启用压缩

1
2
3
4
5
6
7
8
# _config.yml
all_minifier: true
html_minifier:
enable: true
css_minifier:
enable: true
js_minifier:
enable: true

图片懒加载

_config.stellar.yml 中启用:

1
2
3
plugins:
lazyload:
enable: true

💡 提示:SEO 是一个长期过程,持续产出高质量内容是最重要的优化手段。


本站由 Moriefy 使用 Stellar1.22.1 主题创建
使用Hexo Github Vercel 强力驱动
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。

发表了 16 篇文章 · 总计 18.5k 字