This commit is contained in:
Mrx
2026-02-28 12:29:15 +08:00
parent b2da12f3ed
commit a5d9de5736
3 changed files with 61 additions and 32 deletions

View File

@@ -59,7 +59,27 @@ $env:SEO_TEST_URL="https://www.xingfucha.cn"; node test-seo.js
curl -s -A "Baiduspider/2.0" http://localhost:3000/ | findstr /i "title description keywords canonical"
```
应能看到包含「幸福查」的 title以及 description、keywords、canonical 等标签。
应能看到包含「天远数据」的 title以及 description、keywords、canonical 等标签。
**Windows 下中文乱码说明**:服务器返回的是 UTF-8CMD 默认是 GBK直接 `curl … | findstr` 会看到乱码(如 `澶╄繙鏁版嵁`)或出现 “FINDSTR: 写入错误”。可任选一种方式解决:
```cmd
:: 方式 1先切到 UTF-8 再执行CMD
chcp 65001
curl -s -A "Baiduspider/2.0" https://www.tianyuandb.com/ | findstr /i "title description"
```
```powershell
# 方式 2PowerShell 下指定输出编码
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
curl -s -A "Baiduspider/2.0" https://www.tianyuandb.com/ | Select-String -Pattern "title|description"
```
```cmd
:: 方式 3保存到文件后用编辑器打开任意编码都行
curl -s -A "Baiduspider/2.0" https://www.tianyuandb.com/ -o seo-test.html
:: 用记事本/VSCode 打开 seo-test.html选 UTF-8 即可看到正确中文
```
```bash
# 看完整 HTML 前几行(含 <head>