Commit da00dc22 authored by xuchentao's avatar xuchentao

feat: build Zhiyin Future corporate website

parents
# 复制为 .env 后使用。生产环境请生成独立密钥。
CMS_PORT=8792
# 后台主密码始终有效,用于登录和找回;在后台修改的用户密码会另存于 CMS_DATA_DIR。
CMS_PASSWORD=replace-with-a-strong-password
CMS_SECRET=replace-with-openssl-rand-hex-32
CMS_API_KEY=replace-with-openssl-rand-hex-32
# 本地默认放入已忽略的 .runtime;生产环境请改为 /root/zhiyinweilai/shared/ 下的绝对路径。
CMS_DATA_DIR=.runtime/cms-data
CMS_BUILD_LOCK=.runtime/site-build.lock
node_modules/
dist/
.astro/
.codex-tmp/
.runtime/
.env
!.env.example
public/uploads/
.DS_Store
# 智引未来官网 · GitLab CI/CD 单目录覆盖部署
# 流程:停止应用 → 覆盖 current → 安装与构建 → 启动并检查 → 更新 Nginx
# 触发:push 到 main 分支
#
# GitLab 版本:11.7
# 仅使用 stages、only、script 等基础语法;服务器部署锁用于拒绝并发部署。
variables:
DEPLOY_ROOT: "/root/zhiyinweilai"
CURRENT_DIR: "/root/zhiyinweilai/current"
SHARED_DIR: "/root/zhiyinweilai/shared"
SHARED_ENV: "/root/zhiyinweilai/shared/.env"
DEPLOY_LOCK: "/root/zhiyinweilai/shared/deploy.lock"
APP_NAME: "zhiyinweilai"
SITE_URL: "http://127.0.0.1:8792/"
PM2_BIN: "/usr/bin/pm2"
PM2_HOME_DIR: "/root/.pm2"
PM2_USE_SUDO: "1"
PUBLIC_HOST: "www.zhiyintec.com"
stages:
- deploy
deploy:
stage: deploy
tags:
- zhiyinweilai-prod
only:
- main
script:
- |
set -Eeuo pipefail
echo "[deploy] 提交:$CI_COMMIT_SHA"
case "$DEPLOY_ROOT" in
/*) ;;
*) echo "DEPLOY_ROOT 必须是绝对路径" >&2; exit 2 ;;
esac
case "$PM2_BIN" in
/*) ;;
*) echo "PM2_BIN 必须是绝对路径" >&2; exit 2 ;;
esac
case "$PM2_HOME_DIR" in
/*) ;;
*) echo "PM2_HOME_DIR 必须是绝对路径" >&2; exit 2 ;;
esac
if [ "$CURRENT_DIR" != "$DEPLOY_ROOT/current" ] || [ "$SHARED_DIR" != "$DEPLOY_ROOT/shared" ]; then
echo "current 或 shared 目录不属于部署根目录" >&2
exit 2
fi
if [ "$SHARED_ENV" != "$SHARED_DIR/.env" ] || [ "$DEPLOY_LOCK" != "$SHARED_DIR/deploy.lock" ]; then
echo "生产配置或部署锁路径不属于 shared 目录" >&2
exit 2
fi
case "$APP_NAME" in
*[!A-Za-z0-9_.-]*|'') echo "PM2 应用名包含不安全字符" >&2; exit 2 ;;
esac
case "$PM2_USE_SUDO" in
0|1) ;;
*) echo "PM2_USE_SUDO 只能是 0 或 1" >&2; exit 2 ;;
esac
test -n "$CI_COMMIT_SHA" || (echo "CI_COMMIT_SHA 缺失" >&2 && exit 2)
test -x "$PM2_BIN" || (echo "PM2 不存在或不可执行:$PM2_BIN" >&2 && exit 2)
command -v flock >/dev/null || (echo "服务器缺少 flock" >&2 && exit 2)
command -v curl >/dev/null || (echo "服务器缺少 curl" >&2 && exit 2)
command -v node >/dev/null || (echo "服务器缺少 Node.js" >&2 && exit 2)
if [ -L "$DEPLOY_ROOT" ] || { [ -e "$DEPLOY_ROOT" ] && [ ! -d "$DEPLOY_ROOT" ]; }; then
echo "DEPLOY_ROOT 必须是非软链接实体目录:$DEPLOY_ROOT" >&2
exit 2
fi
mkdir -p "$DEPLOY_ROOT"
if [ "$(readlink -f "$DEPLOY_ROOT")" != "$DEPLOY_ROOT" ] || [ -L "$DEPLOY_ROOT" ]; then
echo "DEPLOY_ROOT 必须是非软链接实体目录:$DEPLOY_ROOT" >&2
exit 2
fi
if [ -L "$SHARED_DIR" ] || { [ -e "$SHARED_DIR" ] && [ ! -d "$SHARED_DIR" ]; }; then
echo "shared 必须是非软链接实体目录:$SHARED_DIR" >&2
exit 2
fi
mkdir -p "$SHARED_DIR"
if [ "$(readlink -f "$SHARED_DIR")" != "$SHARED_DIR" ]; then
echo "shared 必须位于指定部署目录:$SHARED_DIR" >&2
exit 2
fi
test -f "$SHARED_ENV" || (echo "缺少生产配置:$SHARED_ENV" >&2 && exit 2)
# GitLab 11.7 没有 resource_group。非阻塞锁让并发 pipeline 直接失败,
# 避免较早的 pipeline 排队后覆盖较新的提交。
exec 9>"$DEPLOY_LOCK"
if ! flock -n 9; then
echo "已有部署正在进行,本次 pipeline 不进入等待队列" >&2
exit 3
fi
pm2_command() {
if [ "$PM2_USE_SUDO" = "1" ]; then
sudo -n env PM2_HOME="$PM2_HOME_DIR" "$PM2_BIN" "$@"
else
env PM2_HOME="$PM2_HOME_DIR" "$PM2_BIN" "$@"
fi
}
# 先停止且只停止本项目进程。单目录部署失败时不会自动回滚。
if pm2_command describe "$APP_NAME" >/dev/null 2>&1; then
echo "[deploy] 停止本项目 PM2 进程:$APP_NAME"
pm2_command delete "$APP_NAME"
fi
# 首次迁移时只移除 current 软链接本身,不触碰它原来指向的 release。
if [ -L "$CURRENT_DIR" ]; then
old_current_target=$(readlink -f "$CURRENT_DIR" 2>/dev/null || true)
echo "[deploy] 移除旧 current 软链接(原目标保留):${old_current_target:-未知}"
unlink "$CURRENT_DIR"
elif [ -e "$CURRENT_DIR" ] && [ ! -d "$CURRENT_DIR" ]; then
echo "current 存在但不是目录,拒绝覆盖:$CURRENT_DIR" >&2
exit 2
fi
mkdir -p "$CURRENT_DIR"
if [ -L "$CURRENT_DIR" ] || [ "$(readlink -f "$CURRENT_DIR")" != "$CURRENT_DIR" ]; then
echo "current 必须是指定位置的实体目录:$CURRENT_DIR" >&2
exit 2
fi
echo "[deploy] 清空 current"
find "$CURRENT_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
echo "[deploy] 导出提交到 current"
git -c safe.directory="$CI_PROJECT_DIR" -C "$CI_PROJECT_DIR" cat-file -e "$CI_COMMIT_SHA^{commit}"
git -c safe.directory="$CI_PROJECT_DIR" -C "$CI_PROJECT_DIR" archive "$CI_COMMIT_SHA" | tar -x -C "$CURRENT_DIR"
ln -s "$SHARED_ENV" "$CURRENT_DIR/.env"
cd "$CURRENT_DIR"
echo "[deploy] 安装依赖"
npm ci
echo "[deploy] 使用 shared 中的 CMS 数据和构建锁进行构建"
node --env-file="$SHARED_ENV" -e '
const path = require("node:path");
const shared = path.resolve(process.argv[1]);
for (const name of ["CMS_DATA_DIR", "CMS_BUILD_LOCK"]) {
const value = process.env[name];
if (!value) throw new Error(`${name} 未配置`);
const resolved = path.resolve(value);
if (resolved === shared || !resolved.startsWith(`${shared}${path.sep}`)) {
throw new Error(`${name} 必须位于 ${shared}/ 下`);
}
}
' "$SHARED_DIR"
node --env-file="$SHARED_ENV" scripts/run-with-site-lock.mjs -- npm run build:inside-lock
echo "[deploy] 启动本项目 PM2 进程"
pm2_command start "$CURRENT_DIR/server.mjs" \
--name "$APP_NAME" \
--cwd "$CURRENT_DIR" \
--node-args="--env-file=$SHARED_ENV"
healthy=0
for attempt in $(seq 1 30); do
if curl --fail --silent --show-error --max-time 3 "$SITE_URL" >/dev/null; then
healthy=1
break
fi
echo "[deploy] 等待服务启动... ($attempt/30)"
sleep 1
done
if [ "$healthy" != "1" ]; then
echo "健康检查失败:$SITE_URL" >&2
pm2_command logs "$APP_NAME" --lines 30 --nostream || true
exit 1
fi
echo "[deploy] 更新并验证 Nginx"
test -f "$CURRENT_DIR/deploy/nginx/zhiyinweilai.conf" || (echo "缺少 Nginx 配置" >&2 && exit 2)
sudo -n /usr/bin/install -o root -g root -m 0644 "$CURRENT_DIR/deploy/nginx/zhiyinweilai.conf" /etc/nginx/conf.d/zhiyinweilai.conf
sudo -n /usr/sbin/nginx -t
sudo -n /usr/bin/systemctl reload nginx
curl --fail --silent --show-error --max-time 5 \
--noproxy "*" \
--resolve "$PUBLIC_HOST:443:127.0.0.1" \
"https://$PUBLIC_HOST/" >/dev/null
echo "[deploy] 部署完成:$CURRENT_DIR"
echo "[deploy] 旧 releases 目录未被读取或清理;确认无用后请人工删除"
# 智引未来洞察内容后台
项目采用与官网同端口的 Astro 内容后台:Markdown 文件负责内容存储,Astro 同时提供管理 API 和静态页面生成。文章列表、分类页和详情页均预渲染为 HTML,便于 SEO 与 GEO 发现。
## 启动
```bash
cp .env.example .env
npm install
npm run dev
```
- 开发官网:`http://localhost:4321/`
- 开发后台:`http://localhost:4321/admin/`
生产模式:
```bash
npm run build
npm start
```
- 官网:`http://localhost:8792/`
- 后台:`http://localhost:8792/admin/`
- 洞察中心:`http://localhost:8792/articles/`
## 环境变量
- `CMS_PORT`:官网与后台共用端口,默认 `8792`
- `CMS_PASSWORD`:后台主密码,也用于密码找回
- `CMS_SECRET`:会话签名密钥
- `CMS_API_KEY`:外部管理 API 的 Bearer Token
- `CMS_DATA_DIR`:仓库外持久化内容目录
- `CMS_BUILD_LOCK`:代码部署与内容发布共用的构建锁
生产建议:
```env
CMS_PORT=8792
CMS_DATA_DIR=/root/zhiyinweilai/shared/cms-data
CMS_BUILD_LOCK=/root/zhiyinweilai/shared/site-build.lock
```
## 内容目录与版本
- `src/content/articles/`:工作稿,包括新草稿和已发布文章的未发布修改
- `src/content/published/`:官网构建使用的线上稿
- `src/content/categories.json`:后台维护的分类
- `public/uploads/`:本地开发的上传图片
配置 `CMS_DATA_DIR` 后,上述用户数据改存到该持久化目录。保存草稿不会改动线上稿;点击发布后,编辑稿才覆盖线上稿并触发静态构建。下架会移除线上稿但保留编辑稿;删除同时移除两版,构建失败时自动恢复。
## 管理 API
所有接口使用 `/api/cms` 前缀:
| 分组 | 方法与地址 | 用途 |
| --- | --- | --- |
| 验证 | `GET /api/cms/captcha` | 获取验证码 |
| 会话 | `GET/POST/DELETE /api/cms/session` | 状态、登录、退出 |
| 账号 | `PUT /api/cms/account/password` | 修改密码并注销已有会话 |
| 分类 | `GET/POST/PATCH/DELETE /api/cms/categories` | 分类管理 |
| 文章 | `GET/POST /api/cms/articles` | 列表与新建草稿 |
| 文章 | `GET/PUT/DELETE /api/cms/articles/:slug` | 读取、保存、删除 |
| 草稿 | `DELETE /api/cms/articles/:slug/draft` | 放弃未发布修改 |
| 发布 | `POST /api/cms/articles/:slug/publish` | 发布并构建 |
| 下架 | `POST /api/cms/articles/:slug/unpublish` | 下架并构建 |
| 工具 | `POST /api/cms/preview` | Markdown 预览 |
| 上传 | `POST /api/cms/uploads` | 上传文章图片 |
| 导入 | `POST /api/cms/imports/word` | 导入 `.docx` 草稿与内嵌图片 |
| 构建 | `GET /api/cms/build` | 查询静态构建状态 |
浏览器后台通过会话 Cookie 鉴权;外部程序可使用 `Authorization: Bearer <CMS_API_KEY>`
## Word 与 Markdown 导入
后台支持 `.md` 和不超过 20MB 的 `.docx`,不支持旧版 `.doc`。第一个一级标题会作为文章标题并从正文移除;Word 内嵌 PNG、JPG、WEBP、GIF 会保存到上传目录并转成 Markdown 图片。导入只创建草稿,不会自动发布;失败时会清理本次已提取图片。
```http
POST /api/cms/imports/word
Authorization: Bearer <CMS_API_KEY>
Content-Type: application/json
```
```json
{
"fileName": "GEO洞察文章.docx",
"dataUrl": "data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,...",
"category": "GEO洞察",
"title": "可选的自定义标题"
}
```
## 构建一致性
发布、下架、删除文章或修改已使用分类时,后台先获取共享构建锁。若代码部署或其他构建已持锁,本次操作返回冲突,不进入等待队列。后台在临时目录执行 Astro 构建,成功后原子替换 `dist/`;失败则恢复内容并保留旧站点。
生产数据必须位于:
```text
/root/zhiyinweilai/
├── current/ # 当前代码和构建产物,部署时覆盖
└── shared/ # .env、CMS 数据、上传文件和锁
```
## GitLab、PM2 与 Nginx
`.gitlab-ci.yml` 使用单目录覆盖部署:停止指定的 `zhiyinweilai` PM2 进程,清空 `current/`,导出当前提交,关联 `shared/.env`,安装依赖并构建,重新启动并进行本机健康检查,最后安装和验证 Nginx 配置。
默认参数:
- 部署根目录:`/root/zhiyinweilai`
- PM2 应用名:`zhiyinweilai`
- 服务端口:`8792`
- Nginx 配置:`/etc/nginx/conf.d/zhiyinweilai.conf`
- 公网域名:`www.zhiyintec.com`
Runner 需要被授权执行固定的配置安装、`nginx -t` 和 reload 命令。建议建立 `/etc/sudoers.d/zhiyinweilai-runner`
```sudoers
Cmnd_Alias ZHIYIN_NGINX = \
/usr/bin/install -o root -g root -m 0644 /root/zhiyinweilai/current/deploy/nginx/zhiyinweilai.conf /etc/nginx/conf.d/zhiyinweilai.conf, \
/usr/sbin/nginx -t, \
/usr/bin/systemctl reload nginx
gitlab-runner ALL=(root) NOPASSWD: ZHIYIN_NGINX
```
完成后使用 `sudo visudo -cf /etc/sudoers.d/zhiyinweilai-runner` 校验语法。
# 智引未来企业官网
西安智引未来人工智能科技有限公司官网。项目基于 Astro 5 + Node standalone adapter,包含品牌官网、GEO/SMO 服务页、响应式适配、搜索增长洞察 CMS、SEO/GEO 基础、原子构建与 GitLab/Nginx 部署配置。
## 本地运行
```bash
npm install
npm run dev
```
- 官网开发地址:`http://localhost:4321/`
- 内容后台:`http://localhost:4321/admin/`
生产构建与本地服务:
```bash
npm run build
npm start
```
生产模式默认监听 `http://127.0.0.1:8792/`
## 常用命令
```bash
npm run check # Astro / TypeScript 检查
npm test # CMS 认证与导入测试
npm run build # 带共享锁的原子生产构建
npm start # 启动 standalone 服务
```
## 内容管理
洞察文章使用 Markdown 存储,并由同端口 `/admin/` 后台管理。工作稿位于 `src/content/articles/`,线上稿位于 `src/content/published/`;生产环境通过 `CMS_DATA_DIR` 将内容持久化到仓库外。发布、下架、删除和分类修改会触发带共享锁的静态页面重建。
后台支持:
- 草稿、发布、下架、删除与未发布修改回退
- 分类新增、重命名、删除与文章迁移
- Markdown 和 Word `.docx` 导入
- 文章图片上传、Markdown 预览和修改密码
- Bearer API 调用与发布构建状态查询
完整说明见 [CMS_README.md](./CMS_README.md)
## SEO 与 AI 可发现性
- 页面级标题、描述、关键词、canonical、Open Graph 和 Twitter Card
- Organization、WebSite、WebPage、Service、FAQ、Article 和 Breadcrumb 结构化数据
- sitemap、robots.txt、语义化页面、静态文章与分类分页
- `/llms.txt``/llms-full.txt` 提供结构化站点摘要与完整内容入口
- Astro 图片优化、移动端适配、减少动态效果偏好与原生懒加载
## 部署
- Astro standalone 输出:`dist/server/``dist/client/`
- GitLab CI:`.gitlab-ci.yml`
- Nginx 配置:`deploy/nginx/zhiyinweilai.conf`
- 生产端口:`8792`
- 站点域名:`www.zhiyintec.com`
- 服务器目录:`/root/zhiyinweilai/current``/root/zhiyinweilai/shared`
生产部署前需在 `/root/zhiyinweilai/shared/.env` 配置独立的 `CMS_PASSWORD``CMS_SECRET``CMS_API_KEY``CMS_DATA_DIR``CMS_BUILD_LOCK`。上传文件、CMS 数据与构建锁必须位于 `shared/`,不能放入部署时会覆盖的 `current/`
import { defineConfig } from "astro/config";
import sitemap from "@astrojs/sitemap";
import node from "@astrojs/node";
import path from "node:path";
const customOutDir = process.env.ZHIYIN_BUILD_OUT_DIR;
export default defineConfig({
site: "https://www.zhiyintec.com",
integrations: [sitemap({
filter: (page) => {
const pathname = new URL(page).pathname;
return pathname !== "/404/"
&& pathname !== "/admin/"
&& !pathname.startsWith("/api/")
&& !pathname.startsWith("/uploads/")
&& !pathname.endsWith(".txt");
},
})],
adapter: node({ mode: "standalone" }),
...(customOutDir ? { outDir: path.resolve(customOutDir) } : {}),
build: { format: "directory" },
trailingSlash: "ignore",
});
# 智引未来官网正式域名:HTTP 统一跳转到 HTTPS 和 www 主域名。
server {
listen 80;
server_name zhiyintec.com www.zhiyintec.com;
return 301 https://www.zhiyintec.com$request_uri;
}
server {
listen 443 ssl http2;
server_name zhiyintec.com;
ssl_certificate /etc/nginx/certs/zhiyintec.com.fullchain.pem;
ssl_certificate_key /etc/nginx/certs/zhiyintec.com.certkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
return 301 https://www.zhiyintec.com$request_uri;
}
server {
listen 443 ssl http2;
server_name www.zhiyintec.com;
ssl_certificate /etc/nginx/certs/zhiyintec.com.fullchain.pem;
ssl_certificate_key /etc/nginx/certs/zhiyintec.com.certkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_session_cache shared:ZHIYIN:10m;
ssl_session_timeout 1d;
ssl_session_tickets off;
client_max_body_size 28m;
location / {
proxy_pass http://127.0.0.1:8792;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
}
This diff is collapsed.
{
"name": "zhiyinweilai-official-site",
"type": "module",
"version": "1.0.0",
"private": true,
"engines": {
"node": ">=20.20.0 <21"
},
"scripts": {
"dev": "node --env-file=.env ./node_modules/astro/astro.js dev",
"build": "node scripts/build-site.mjs",
"build:inside-lock": "node scripts/build-site.mjs --inside-lock",
"build:astro": "astro check && astro build",
"preview": "astro preview",
"check": "astro check",
"test": "node --import tsx/esm --test tests/*.test.ts",
"start": "node --env-file=.env server.mjs",
"admin": "npm start",
"serve": "npm run build && npm start"
},
"dependencies": {
"@astrojs/node": "9.5.5",
"@astrojs/sitemap": "^3.7.3",
"astro": "5.18.2",
"gray-matter": "^4.0.3",
"mammoth": "^1.12.0",
"marked": "^14.1.4",
"turndown": "^7.2.4",
"turndown-plugin-gfm": "^1.0.2"
},
"devDependencies": {
"@astrojs/check": "^0.9.6",
"@types/turndown": "^5.0.6",
"docx": "^9.7.1",
"tsx": "^4.23.1",
"typescript": "^5.9.3"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="775" height="199" viewBox="0 0 775 199" fill="none">
<defs>
<linearGradient id="bottomGrad" x1="0" y1="0" x2="775" y2="0" gradientUnits="userSpaceOnUse">
<stop offset="0%" stop-color="#3dd6fe"/>
<stop offset="50%" stop-color="#25a4fe"/>
<stop offset="100%" stop-color="#1178fe"/>
</linearGradient>
</defs>
<path d="M 124.0 59.0 L 123.0 63.0 L 123.0 81.0 L 124.0 85.0 L 128.0 89.0 L 177.0 89.0 L 181.0 88.0 L 186.0 81.0 L 186.0 76.0 L 182.0 77.0 L 181.0 79.0 L 179.0 79.0 L 175.0 82.0 L 174.0 81.0 L 133.0 81.0 L 131.0 79.0 L 131.0 64.0 L 132.0 63.0 L 176.0 63.0 L 177.0 62.0 L 179.0 64.0 L 177.0 68.0 L 140.0 68.0 L 139.0 69.0 L 139.0 75.0 L 140.0 76.0 L 174.0 76.0 L 175.0 75.0 L 180.0 75.0 L 186.0 69.0 L 186.0 58.0 L 181.0 55.0 L 130.0 55.0 Z M 547.0 45.0 L 547.0 53.0 L 579.0 53.0 L 579.0 44.0 L 548.0 44.0 Z M 159.0 34.0 L 176.0 52.0 L 178.0 52.0 L 194.0 36.0 L 194.0 34.0 L 185.0 34.0 L 176.0 42.0 L 169.0 34.0 Z M 416.0 30.0 L 407.0 30.0 L 405.0 37.0 L 402.0 41.0 L 402.0 44.0 L 410.0 44.0 L 414.0 37.0 L 414.0 34.0 L 416.0 32.0 Z M 362.0 30.0 L 368.0 44.0 L 376.0 44.0 L 371.0 30.0 Z M 530.0 22.0 L 524.0 28.0 L 521.0 33.0 L 517.0 46.0 L 517.0 53.0 L 519.0 57.0 L 519.0 61.0 L 524.0 70.0 L 530.0 76.0 L 545.0 82.0 L 554.0 82.0 L 555.0 83.0 L 580.0 82.0 L 580.0 70.0 L 547.0 70.0 L 540.0 67.0 L 535.0 62.0 L 531.0 55.0 L 532.0 40.0 L 539.0 32.0 L 547.0 28.0 L 580.0 28.0 L 580.0 16.0 L 546.0 16.0 L 537.0 18.0 Z M 458.0 19.0 L 452.0 23.0 L 448.0 27.0 L 447.0 30.0 L 445.0 31.0 L 440.0 47.0 L 441.0 57.0 L 447.0 70.0 L 453.0 76.0 L 460.0 80.0 L 474.0 83.0 L 490.0 82.0 L 497.0 78.0 L 499.0 78.0 L 505.0 72.0 L 508.0 63.0 L 508.0 44.0 L 474.0 44.0 L 474.0 54.0 L 494.0 54.0 L 496.0 56.0 L 495.0 63.0 L 491.0 68.0 L 489.0 68.0 L 487.0 70.0 L 472.0 70.0 L 463.0 66.0 L 455.0 56.0 L 454.0 45.0 L 459.0 35.0 L 471.0 28.0 L 506.0 28.0 L 506.0 16.0 L 469.0 16.0 Z M 610.0 17.0 L 600.0 23.0 L 591.0 35.0 L 589.0 44.0 L 589.0 55.0 L 591.0 63.0 L 595.0 68.0 L 595.0 70.0 L 602.0 77.0 L 607.0 80.0 L 610.0 80.0 L 616.0 83.0 L 618.0 82.0 L 619.0 83.0 L 628.0 83.0 L 637.0 81.0 L 648.0 74.0 L 651.0 69.0 L 653.0 68.0 L 653.0 66.0 L 656.0 62.0 L 658.0 53.0 L 658.0 45.0 L 657.0 44.0 L 658.0 42.0 L 651.0 27.0 L 639.0 18.0 L 636.0 18.0 L 633.0 16.0 L 620.0 16.0 L 619.0 15.0 L 614.0 17.0 Z M 617.0 28.0 L 630.0 28.0 L 639.0 34.0 L 645.0 46.0 L 644.0 55.0 L 640.0 63.0 L 633.0 69.0 L 628.0 71.0 L 619.0 71.0 L 612.0 68.0 L 605.0 61.0 L 602.0 54.0 L 603.0 53.0 L 602.0 47.0 L 604.0 39.0 L 609.0 33.0 Z M 198.0 15.0 L 198.0 22.0 L 229.0 22.0 L 230.0 23.0 L 230.0 32.0 L 229.0 33.0 L 205.0 33.0 L 200.0 37.0 L 199.0 40.0 L 200.0 43.0 L 199.0 53.0 L 200.0 56.0 L 204.0 59.0 L 207.0 60.0 L 232.0 60.0 L 233.0 61.0 L 231.0 70.0 L 226.0 77.0 L 218.0 81.0 L 211.0 81.0 L 210.0 82.0 L 203.0 81.0 L 203.0 89.0 L 214.0 89.0 L 215.0 88.0 L 225.0 87.0 L 234.0 81.0 L 240.0 69.0 L 240.0 56.0 L 235.0 52.0 L 209.0 51.0 L 208.0 50.0 L 208.0 42.0 L 209.0 41.0 L 233.0 41.0 L 236.0 40.0 L 239.0 36.0 L 239.0 15.0 L 236.0 14.0 L 204.0 14.0 L 203.0 15.0 Z M 356.0 19.0 L 356.0 26.0 L 383.0 26.0 L 384.0 27.0 L 384.0 47.0 L 383.0 48.0 L 352.0 48.0 L 352.0 55.0 L 373.0 55.0 L 374.0 56.0 L 368.0 66.0 L 359.0 75.0 L 352.0 78.0 L 354.0 87.0 L 359.0 85.0 L 360.0 83.0 L 362.0 83.0 L 374.0 72.0 L 375.0 69.0 L 378.0 66.0 L 380.0 60.0 L 384.0 56.0 L 385.0 57.0 L 385.0 89.0 L 393.0 89.0 L 393.0 56.0 L 394.0 55.0 L 396.0 56.0 L 396.0 59.0 L 403.0 71.0 L 414.0 82.0 L 416.0 82.0 L 417.0 84.0 L 424.0 87.0 L 426.0 78.0 L 420.0 76.0 L 419.0 74.0 L 416.0 73.0 L 410.0 67.0 L 403.0 56.0 L 404.0 55.0 L 425.0 55.0 L 425.0 48.0 L 394.0 48.0 L 393.0 47.0 L 393.0 27.0 L 394.0 26.0 L 421.0 26.0 L 421.0 19.0 L 394.0 19.0 L 393.0 18.0 L 393.0 10.0 L 385.0 10.0 L 385.0 17.0 L 383.0 19.0 Z M 254.0 10.0 L 254.0 89.0 L 261.0 89.0 L 261.0 10.0 Z M 277.0 21.0 L 277.0 28.0 L 303.0 28.0 L 304.0 29.0 L 304.0 40.0 L 303.0 41.0 L 273.0 41.0 L 273.0 49.0 L 290.0 49.0 L 291.0 50.0 L 291.0 52.0 L 289.0 54.0 L 289.0 57.0 L 283.0 67.0 L 276.0 74.0 L 271.0 77.0 L 274.0 85.0 L 279.0 83.0 L 289.0 73.0 L 289.0 71.0 L 291.0 70.0 L 291.0 68.0 L 295.0 63.0 L 298.0 52.0 L 300.0 49.0 L 304.0 50.0 L 304.0 88.0 L 312.0 88.0 L 312.0 51.0 L 314.0 49.0 L 318.0 52.0 L 319.0 58.0 L 329.0 75.0 L 336.0 82.0 L 339.0 83.0 L 340.0 85.0 L 343.0 84.0 L 343.0 81.0 L 345.0 79.0 L 344.0 76.0 L 341.0 75.0 L 334.0 68.0 L 333.0 65.0 L 331.0 64.0 L 331.0 62.0 L 328.0 59.0 L 325.0 51.0 L 326.0 49.0 L 343.0 49.0 L 343.0 42.0 L 342.0 41.0 L 316.0 42.0 L 312.0 40.0 L 312.0 30.0 L 314.0 28.0 L 339.0 28.0 L 339.0 21.0 L 313.0 21.0 L 312.0 20.0 L 312.0 10.0 L 307.0 10.0 L 306.0 9.0 L 304.0 9.0 L 304.0 20.0 L 303.0 21.0 Z M 127.0 9.0 L 126.0 13.0 L 122.0 18.0 L 118.0 20.0 L 118.0 27.0 L 122.0 27.0 L 128.0 23.0 L 136.0 23.0 L 137.0 27.0 L 135.0 30.0 L 118.0 30.0 L 118.0 37.0 L 119.0 38.0 L 131.0 38.0 L 132.0 37.0 L 133.0 38.0 L 127.0 44.0 L 119.0 46.0 L 118.0 47.0 L 118.0 53.0 L 123.0 53.0 L 127.0 51.0 L 130.0 51.0 L 137.0 46.0 L 140.0 42.0 L 145.0 48.0 L 149.0 49.0 L 151.0 51.0 L 157.0 52.0 L 157.0 45.0 L 151.0 43.0 L 145.0 38.0 L 146.0 37.0 L 156.0 37.0 L 156.0 30.0 L 145.0 30.0 L 144.0 29.0 L 145.0 27.0 L 144.0 25.0 L 146.0 23.0 L 157.0 23.0 L 157.0 16.0 L 135.0 16.0 L 133.0 17.0 L 132.0 16.0 L 134.0 12.0 L 134.0 9.0 Z" fill="#172e87" fill-rule="evenodd"/>
<path d="M 157.0 31.0 L 157.0 33.0 L 168.0 33.0 L 177.0 24.0 L 186.0 33.0 L 196.0 33.0 L 195.0 30.0 L 178.0 13.0 L 176.0 13.0 Z" fill="#3bccf7" fill-rule="evenodd"/>
<path d="M 423.0 154.0 L 423.0 167.0 L 452.0 167.0 L 452.0 154.0 Z M 736.0 153.0 L 736.0 165.0 L 767.0 165.0 L 767.0 153.0 Z M 197.0 153.0 L 197.0 165.0 L 228.0 165.0 L 228.0 153.0 Z M 722.0 134.0 L 714.0 143.0 L 710.0 155.0 L 711.0 168.0 L 718.0 181.0 L 726.0 187.0 L 735.0 190.0 L 766.0 191.0 L 767.0 190.0 L 767.0 175.0 L 738.0 175.0 L 734.0 173.0 L 728.0 167.0 L 726.0 158.0 L 729.0 150.0 L 736.0 144.0 L 740.0 143.0 L 767.0 143.0 L 767.0 128.0 L 739.0 128.0 L 727.0 131.0 Z M 650.0 128.0 L 650.0 190.0 L 666.0 190.0 L 666.0 144.0 L 667.0 143.0 L 683.0 143.0 L 689.0 148.0 L 689.0 152.0 L 685.0 157.0 L 673.0 157.0 L 672.0 158.0 L 672.0 166.0 L 689.0 190.0 L 707.0 190.0 L 705.0 185.0 L 692.0 168.0 L 699.0 164.0 L 704.0 156.0 L 705.0 146.0 L 701.0 137.0 L 696.0 132.0 L 685.0 128.0 Z M 586.0 128.0 L 586.0 170.0 L 588.0 176.0 L 592.0 182.0 L 598.0 187.0 L 609.0 191.0 L 619.0 191.0 L 626.0 189.0 L 631.0 186.0 L 638.0 178.0 L 641.0 170.0 L 641.0 128.0 L 626.0 128.0 L 626.0 165.0 L 623.0 172.0 L 617.0 176.0 L 608.0 175.0 L 602.0 168.0 L 602.0 162.0 L 601.0 161.0 L 601.0 128.0 Z M 579.0 128.0 L 560.0 129.0 L 554.0 132.0 L 548.0 138.0 L 544.0 148.0 L 544.0 190.0 L 560.0 190.0 L 560.0 144.0 L 561.0 143.0 L 579.0 143.0 Z M 524.0 143.0 L 540.0 143.0 L 543.0 135.0 L 549.0 128.0 L 524.0 128.0 Z M 462.0 128.0 L 461.0 129.0 L 461.0 165.0 L 462.0 166.0 L 462.0 171.0 L 466.0 180.0 L 474.0 187.0 L 485.0 191.0 L 494.0 191.0 L 505.0 187.0 L 513.0 179.0 L 517.0 170.0 L 517.0 165.0 L 518.0 164.0 L 518.0 129.0 L 517.0 128.0 L 502.0 128.0 L 502.0 166.0 L 500.0 171.0 L 497.0 174.0 L 493.0 176.0 L 486.0 176.0 L 482.0 174.0 L 477.0 167.0 L 477.0 128.0 Z M 453.0 128.0 L 424.0 128.0 L 419.0 129.0 L 410.0 134.0 L 406.0 138.0 L 401.0 148.0 L 401.0 156.0 L 400.0 157.0 L 400.0 166.0 L 401.0 167.0 L 400.0 171.0 L 400.0 189.0 L 401.0 190.0 L 416.0 190.0 L 416.0 153.0 L 417.0 150.0 L 422.0 145.0 L 426.0 143.0 L 454.0 143.0 L 454.0 129.0 Z M 312.0 128.0 L 311.0 130.0 L 312.0 131.0 L 312.0 166.0 L 313.0 167.0 L 326.0 167.0 L 328.0 166.0 L 328.0 147.0 L 327.0 145.0 L 329.0 143.0 L 343.0 144.0 L 348.0 148.0 L 352.0 156.0 L 351.0 165.0 L 346.0 172.0 L 340.0 175.0 L 312.0 176.0 L 311.0 177.0 L 312.0 190.0 L 343.0 190.0 L 355.0 185.0 L 363.0 177.0 L 368.0 165.0 L 368.0 152.0 L 363.0 141.0 L 355.0 133.0 L 346.0 129.0 L 341.0 129.0 L 340.0 128.0 Z M 173.0 148.0 L 172.0 167.0 L 175.0 174.0 L 182.0 183.0 L 186.0 186.0 L 196.0 190.0 L 241.0 190.0 L 248.0 187.0 L 253.0 182.0 L 268.0 151.0 L 272.0 157.0 L 272.0 159.0 L 287.0 190.0 L 304.0 190.0 L 302.0 183.0 L 279.0 133.0 L 272.0 128.0 L 265.0 128.0 L 258.0 133.0 L 241.0 169.0 L 234.0 175.0 L 199.0 175.0 L 195.0 173.0 L 190.0 168.0 L 188.0 164.0 L 188.0 154.0 L 190.0 150.0 L 195.0 145.0 L 200.0 143.0 L 228.0 143.0 L 228.0 128.0 L 200.0 128.0 L 188.0 131.0 L 179.0 138.0 Z M 115.0 128.0 L 115.0 170.0 L 119.0 179.0 L 126.0 186.0 L 135.0 190.0 L 167.0 190.0 L 167.0 174.0 L 132.0 174.0 L 131.0 173.0 L 131.0 129.0 L 130.0 128.0 Z M 89.0 128.0 L 89.0 190.0 L 104.0 190.0 L 105.0 189.0 L 105.0 129.0 L 104.0 128.0 Z M 38.0 130.0 L 35.0 133.0 L 30.0 143.0 L 30.0 145.0 L 10.0 187.0 L 10.0 190.0 L 27.0 190.0 L 32.0 180.0 L 52.0 180.0 L 47.0 166.0 L 39.0 164.0 L 45.0 151.0 L 47.0 152.0 L 47.0 154.0 L 64.0 190.0 L 82.0 190.0 L 57.0 134.0 L 52.0 129.0 L 49.0 128.0 L 42.0 128.0 Z" fill="url(#bottomGrad)" fill-rule="evenodd"/>
</svg>
This diff is collapsed.
This diff is collapsed.
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="630" viewBox="0 0 1200 630">
<defs>
<radialGradient id="blue" cx="0" cy="0" r="1" gradientTransform="translate(170 90) rotate(45) scale(530)"><stop stop-color="#DCEEFF"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
<radialGradient id="green" cx="0" cy="0" r="1" gradientTransform="translate(1060 500) rotate(210) scale(480)"><stop stop-color="#DDF9F0"/><stop offset="1" stop-color="#fff" stop-opacity="0"/></radialGradient>
<linearGradient id="brand" x1="0" x2="1"><stop stop-color="#1473E6"/><stop offset=".55" stop-color="#19C7C4"/><stop offset="1" stop-color="#10B981"/></linearGradient>
</defs>
<rect width="1200" height="630" fill="#fff"/><rect width="1200" height="630" fill="url(#blue)"/><rect width="1200" height="630" fill="url(#green)"/>
<path d="M0 100H1200M0 200H1200M0 300H1200M0 400H1200M0 500H1200M200 0V630M400 0V630M600 0V630M800 0V630M1000 0V630" stroke="#1473E6" stroke-opacity=".055"/>
<rect x="82" y="74" width="210" height="44" rx="22" fill="#F1F7FF" stroke="#CFE3FB"/><circle cx="108" cy="96" r="6" fill="#10B981"/><text x="126" y="103" fill="#073B83" font-family="sans-serif" font-size="18" font-weight="600">GEO + SMO 双引擎</text>
<text x="82" y="266" fill="#142033" font-family="sans-serif" font-size="76" font-weight="700">智引未来,让品牌</text>
<text x="82" y="363" fill="url(#brand)" font-family="sans-serif" font-size="76" font-weight="700">被每一个搜索看见</text>
<text x="86" y="430" fill="#526070" font-family="sans-serif" font-size="26">全域搜索优化与大数据分析服务商</text>
<g transform="translate(850 160)"><circle cx="130" cy="130" r="125" fill="#fff" stroke="#DCEAF8"/><circle cx="130" cy="130" r="84" fill="none" stroke="#19C7C4" stroke-opacity=".4"/><circle cx="130" cy="130" r="44" fill="url(#brand)"/><text x="104" y="141" fill="#fff" font-family="sans-serif" font-size="30" font-weight="700">AI</text><circle cx="25" cy="75" r="12" fill="#1473E6"/><circle cx="238" cy="78" r="12" fill="#10B981"/><circle cx="192" cy="240" r="9" fill="#19C7C4"/></g>
<rect x="82" y="520" width="1036" height="2" fill="url(#brand)"/><text x="82" y="567" fill="#073B83" font-family="sans-serif" font-size="20" font-weight="600">AILEAD FUTURE</text><text x="1118" y="567" fill="#8491A3" font-family="sans-serif" font-size="18" text-anchor="end">www.zhiyintec.com</text>
</svg>
User-agent: *
Allow: /
Disallow: /admin/
Disallow: /api/
Sitemap: https://www.zhiyintec.com/sitemap-index.xml
{
"name": "智引未来",
"short_name": "智引未来",
"description": "GEO与SMO全域搜索优化服务商",
"start_url": "/",
"display": "standalone",
"background_color": "#FFFFFF",
"theme_color": "#1473E6",
"lang": "zh-CN",
"icons": [
{
"src": "/favicon.png",
"sizes": "955x955",
"type": "image/png",
"purpose": "any maskable"
}
]
}
import { buildSiteAtomic, withSiteBuildLock } from "./site-build.mjs";
try {
const build = () => buildSiteAtomic({ onOutput: (text) => process.stdout.write(text) });
if (process.argv.includes("--inside-lock")) {
if (process.env.ZHIYIN_SITE_LOCK_HELD !== "1") throw new Error("build:inside-lock 只能在共享构建锁中运行");
await build();
} else {
await withSiteBuildLock(build);
}
} catch (error) {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
}
import fs from "node:fs/promises";
import path from "node:path";
import { Document, HeadingLevel, ImageRun, Packer, Paragraph, TextRun } from "docx";
const root = process.cwd();
const outputDirectory = path.join(root, "tests", "fixtures");
const imageFile = path.join(root, "pic", "智引未来GEO_原始版本_渐变背景.png");
const marker = "ZHIYIN-PRODUCTION-IMPORT-20260811";
await fs.mkdir(outputDirectory, { recursive: true });
await fs.writeFile(path.join(outputDirectory, "import-test.md"), [
"# 企业开始GEO诊断前,建议先准备这五类信息",
"",
"一次有效的GEO诊断,需要把品牌事实、用户问题和当前AI可见结果放在同一个框架中观察。准备资料不必复杂,但应尽量准确。",
"",
"![智引未来品牌示意图]({{TEST_IMAGE_URL}})",
"",
"## 一、品牌与业务简介",
"",
"用简洁语言说明企业是谁、服务谁、解决什么问题,以及当前最重要的产品与市场。",
"",
"## 二、核心品牌与品类关键词",
"",
"整理用户可能主动搜索的品牌词、品类词、场景词和问题词,作为诊断范围的初始输入。",
"",
"## 三、重点竞品与替代方案",
"",
"列出用户在比较阶段可能同时考虑的品牌或方案,便于观察AI回答中的推荐结构。",
"",
"## 四、现有官方内容",
"",
"准备官网、公众号、产品资料和权威报道等内容入口,确认品牌事实是否统一。",
"",
"## 五、当前最关心的问题",
"",
"说明品牌是完全没有被提及、描述不准确,还是在关键问题中被竞品压制。",
"",
"智引未来会基于真实可见结果建立诊断基线,让后续优化有明确方向和可追溯依据。",
"",
`测试标记:${marker}-MARKDOWN`,
"",
].join("\n"));
const image = await fs.readFile(imageFile);
const heading = (text) => new Paragraph({ text, heading: HeadingLevel.HEADING_2 });
const body = (text) => new Paragraph({ children: [new TextRun(text)] });
const document = new Document({
sections: [{
children: [
new Paragraph({ text: "企业如何开始一次AI搜索可见度诊断", heading: HeadingLevel.HEADING_1 }),
body("AI搜索可见度诊断的目标,是确认品牌在哪些问题中出现、如何被描述,以及信息来自哪些引用来源。"),
new Paragraph({ children: [new ImageRun({ data: image, transformation: { width: 320, height: 320 }, type: "png", altText: { title: "智引未来测试图片", description: "用于验证Word导入图片提取", name: "test.png" } })] }),
heading("建立品牌事实基线"),
body("先确认企业名称、业务定位、产品服务、联系方式和官方表达,避免不同内容入口相互矛盾。"),
heading("定义用户问题集合"),
body("围绕认知、比较、验证和决策阶段整理问题,观察品牌和竞品在回答中的真实位置。"),
heading("记录引用与推荐语境"),
body("不仅记录是否被提及,还要确认引用来源、描述准确性和推荐理由。"),
heading("形成可持续监测范围"),
body("平台和回答会持续变化,因此诊断基线应能进入后续监测、优化与复盘。"),
body(`测试标记:${marker}-WORD`),
],
}],
});
await fs.writeFile(path.join(outputDirectory, "import-test.docx"), await Packer.toBuffer(document));
console.log(`Created fixtures in ${outputDirectory}`);
import { spawn } from "node:child_process";
import { withSiteBuildLock } from "./site-build.mjs";
const separator = process.argv.indexOf("--");
const command = separator >= 0 ? process.argv.slice(separator + 1) : [];
if (!command.length) {
console.error("用法:node scripts/run-with-site-lock.mjs -- <部署命令> [参数]");
process.exit(2);
}
await withSiteBuildLock(() => new Promise((resolve, reject) => {
const child = spawn(command[0], command.slice(1), {
stdio: "inherit",
env: { ...process.env, ZHIYIN_SITE_LOCK_HELD: "1" },
});
child.on("error", reject);
child.on("exit", (code, signal) => {
if (code === 0) resolve();
else reject(new Error(signal ? `部署命令被信号 ${signal} 终止` : `部署命令退出码:${code}`));
});
})).catch((error) => {
console.error(error instanceof Error ? error.message : error);
process.exitCode = 1;
});
export interface BuildOptions {
onOutput?: (text: string) => void;
}
export class SiteBuildLockBusyError extends Error {}
export function tryAcquireSiteBuildLock(): Promise<(() => Promise<void>) | null>;
export function withSiteBuildLock<T>(task: () => Promise<T>, options?: { timeoutMs?: number }): Promise<T>;
export function buildSiteAtomic(options?: BuildOptions): Promise<string>;
import crypto from "node:crypto";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { spawn } from "node:child_process";
const ROOT = process.cwd();
const RUNTIME_DIR = path.join(ROOT, ".runtime");
const DEFAULT_LOCK = process.env.CMS_DATA_DIR
? path.join(path.resolve(process.env.CMS_DATA_DIR), ".site-build.lock")
: path.join(RUNTIME_DIR, "site-build.lock");
const LOCK_FILE = path.resolve(process.env.CMS_BUILD_LOCK || DEFAULT_LOCK);
const RECOVERY_LOCK_FILE = `${LOCK_FILE}.recovery`;
const ASTRO_BIN = path.join(ROOT, "node_modules", "astro", "astro.js");
const DIST_DIR = path.join(ROOT, "dist");
const MAX_LOG_LENGTH = 2 * 1024 * 1024;
export class SiteBuildLockBusyError extends Error {
constructor() {
super("网站正在部署或生成静态页面,请稍后重试");
this.name = "SiteBuildLockBusyError";
}
}
const delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
async function fileExists(file) {
try { await fs.access(file); return true; } catch { return false; }
}
function processIsAlive(pid) {
if (!Number.isInteger(pid) || pid <= 0) return false;
try { process.kill(pid, 0); return true; } catch { return false; }
}
async function removeStaleLock() {
let recoveryHandle;
try {
recoveryHandle = await fs.open(RECOVERY_LOCK_FILE, "wx");
const raw = await fs.readFile(LOCK_FILE, "utf8");
const lock = JSON.parse(raw);
const sameHost = lock.hostname === os.hostname();
if (sameHost && !processIsAlive(Number(lock.pid))) {
await fs.unlink(LOCK_FILE);
return true;
}
} catch (error) {
if (error.code === "ENOENT") return true;
if (error.code === "EEXIST") return false;
} finally {
if (recoveryHandle) {
await recoveryHandle.close().catch(() => {});
await fs.unlink(RECOVERY_LOCK_FILE).catch(() => {});
}
}
return false;
}
async function acquireSiteBuildLock(timeoutMs = 15 * 60 * 1000) {
await fs.mkdir(path.dirname(LOCK_FILE), { recursive: true });
const started = Date.now();
const token = crypto.randomBytes(12).toString("hex");
while (true) {
try {
const handle = await fs.open(LOCK_FILE, "wx");
await handle.writeFile(JSON.stringify({ token, pid: process.pid, hostname: os.hostname(), startedAt: new Date().toISOString() }));
await handle.close();
return async () => {
try {
const current = JSON.parse(await fs.readFile(LOCK_FILE, "utf8"));
if (current.token === token) await fs.unlink(LOCK_FILE);
} catch (error) {
if (error.code !== "ENOENT") throw error;
}
};
} catch (error) {
if (error.code !== "EEXIST") throw error;
if (await removeStaleLock()) continue;
if (Date.now() - started >= timeoutMs) throw new SiteBuildLockBusyError();
await delay(300);
}
}
}
export async function tryAcquireSiteBuildLock() {
try {
return await acquireSiteBuildLock(0);
} catch (error) {
if (error instanceof SiteBuildLockBusyError) return null;
throw error;
}
}
export async function withSiteBuildLock(task, options = {}) {
const release = await acquireSiteBuildLock(options.timeoutMs);
try { return await task(); } finally { await release(); }
}
function runAstro(command, env, onOutput) {
return new Promise((resolve, reject) => {
const child = spawn(process.execPath, [ASTRO_BIN, command], { cwd: ROOT, env: { ...process.env, ...env } });
let log = "";
const append = (chunk) => {
const text = chunk.toString();
log = `${log}${text}`.slice(-MAX_LOG_LENGTH);
onOutput?.(text);
};
child.stdout.on("data", append);
child.stderr.on("data", append);
child.on("error", reject);
child.on("exit", (code) => code === 0 ? resolve(log) : reject(Object.assign(new Error(`astro ${command} 执行失败`), { log })));
});
}
export async function buildSiteAtomic(options = {}) {
await fs.mkdir(RUNTIME_DIR, { recursive: true });
const id = `${Date.now()}-${process.pid}-${crypto.randomBytes(4).toString("hex")}`;
const temporary = path.join(RUNTIME_DIR, `dist-${id}`);
const backup = path.join(RUNTIME_DIR, `dist-backup-${id}`);
let movedCurrent = false;
let log = "";
try {
log += await runAstro("check", {}, options.onOutput);
log += await runAstro("build", { ZHIYIN_BUILD_OUT_DIR: temporary }, options.onOutput);
if (await fileExists(DIST_DIR)) {
await fs.rename(DIST_DIR, backup);
movedCurrent = true;
}
try {
await fs.rename(temporary, DIST_DIR);
} catch (error) {
if (movedCurrent) await fs.rename(backup, DIST_DIR);
throw error;
}
if (movedCurrent) {
await fs.rm(backup, { recursive: true, force: true }).catch((error) => {
options.onOutput?.(`\n旧构建目录清理失败,可稍后手动清理:${error.message}\n`);
});
}
return log;
} catch (error) {
await fs.rm(temporary, { recursive: true, force: true });
if (movedCurrent && !await fileExists(DIST_DIR) && await fileExists(backup)) await fs.rename(backup, DIST_DIR);
if (error.log) error.log = `${log}${error.log}`.slice(-MAX_LOG_LENGTH);
else error.log = log;
throw error;
}
}
import assert from "node:assert/strict";
import fs from "node:fs/promises";
import path from "node:path";
const baseUrl = process.env.CMS_BASE_URL || "http://127.0.0.1:8792";
const apiKey = process.env.CMS_API_KEY;
if (!apiKey) throw new Error("CMS_API_KEY 未配置");
const headers = { Authorization: `Bearer ${apiKey}` };
const jsonHeaders = { ...headers, "Content-Type": "application/json" };
async function request(route, options = {}) {
const response = await fetch(`${baseUrl}/api/cms${route}`, {
...options,
headers: { ...headers, ...options.headers },
});
const payload = await response.json().catch(() => ({}));
if (!response.ok) throw new Error(`${options.method || "GET"} ${route} 返回 ${response.status}${payload.error || "未知错误"}`);
return payload;
}
const categories = await request("/categories");
for (const required of ["GEO洞察", "AI搜索"]) assert.ok(categories.categories.includes(required));
const image = await fs.readFile(path.resolve("pic/智引未来GEO_原始版本_渐变背景.png"));
const uploadedImage = await request("/uploads", {
method: "POST",
headers: jsonHeaders,
body: JSON.stringify({ dataUrl: `data:image/png;base64,${image.toString("base64")}` }),
});
const markdownFile = path.resolve("tests/fixtures/import-test.md");
let markdown = await fs.readFile(markdownFile, "utf8");
const heading = markdown.match(/^#\s+(.+)$/m);
assert.ok(heading?.index !== undefined);
const markdownTitle = heading[1].trim();
markdown = `${markdown.slice(0, heading.index)}${markdown.slice(heading.index + heading[0].length)}`
.trim()
.replace("{{TEST_IMAGE_URL}}", uploadedImage.url);
const markdownImport = await request("/articles", {
method: "POST",
headers: jsonHeaders,
body: JSON.stringify({ title: markdownTitle, category: "GEO洞察", body: markdown }),
});
const docxFile = path.resolve("tests/fixtures/import-test.docx");
const docx = await fs.readFile(docxFile);
const wordImport = await request("/imports/word", {
method: "POST",
headers: jsonHeaders,
body: JSON.stringify({
fileName: path.basename(docxFile),
category: "AI搜索",
dataUrl: `data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,${docx.toString("base64")}`,
}),
});
const markdownArticle = await request(`/articles/${markdownImport.slug}`);
const wordArticle = await request(`/articles/${wordImport.slug}`);
assert.equal(markdownImport.publishStatus, "new-draft");
assert.equal(markdownArticle.title, markdownTitle);
assert.equal(markdownArticle.category, "GEO洞察");
assert.match(markdownArticle.body, /ZHIYIN-PRODUCTION-IMPORT-20260811-MARKDOWN/);
assert.match(markdownArticle.body, new RegExp(uploadedImage.url.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")));
assert.equal(wordImport.publishStatus, "new-draft");
assert.equal(wordImport.title, "企业如何开始一次AI搜索可见度诊断");
assert.equal(wordImport.imageCount, 1);
assert.equal(wordArticle.category, "AI搜索");
assert.match(wordArticle.body, /ZHIYIN-PRODUCTION-IMPORT-20260811-WORD/);
assert.doesNotMatch(wordArticle.body, /^#\s+企业如何开始一次AI搜索可见度诊断/m);
const wordImageUrl = wordArticle.body.match(/!\[[^\]]*\]\((\/uploads\/[^)]+)\)/)?.[1];
assert.ok(wordImageUrl);
for (const imageUrl of [uploadedImage.url, wordImageUrl]) {
const response = await fetch(`${baseUrl}${imageUrl}`);
assert.equal(response.status, 200);
assert.equal(response.headers.get("content-type"), "image/png");
assert.deepEqual(Buffer.from(await response.arrayBuffer()), image);
}
console.log(JSON.stringify({
markdown: { slug: markdownImport.slug, title: markdownArticle.title, imageUrl: uploadedImage.url, publishStatus: markdownImport.publishStatus },
word: { slug: wordImport.slug, title: wordImport.title, imageUrl: wordImageUrl, imageCount: wordImport.imageCount, publishStatus: wordImport.publishStatus, warnings: wordImport.warnings },
}, null, 2));
process.env.PORT ||= process.env.CMS_PORT || "8792";
process.env.HOST ||= "127.0.0.1";
await import("./dist/server/entry.mjs");
---
import { fmtDate, paginationWindow, type Article, type CategoryInfo } from "../lib/articles";
interface Props {
items: Article[];
categories: CategoryInfo[];
totalCount: number;
activeSlug: string | null;
currentPage: number;
lastPage: number;
basePath: string;
}
const { items, categories, totalCount, activeSlug, currentPage, lastPage, basePath } = Astro.props as Props;
const pageHref = (page: number) => page <= 1 ? `${basePath}/` : `${basePath}/page/${page}/`;
const pages = paginationWindow(currentPage, lastPage);
---
<nav class="article-tabs" aria-label="搜索增长洞察分类">
<a class:list={["article-tab", { active: activeSlug === null }]} href="/articles/">全部 <span>{totalCount}</span></a>
{categories.map((category) => (
<a class:list={["article-tab", { active: activeSlug === category.slug }]} href={`/articles/topic/${category.slug}/`}>
{category.name} <span>{category.count}</span>
</a>
))}
</nav>
{items.length ? (
<div class="article-grid">
{items.map((item, index) => (
<article class="article-card" data-reveal>
<a href={`/articles/${item.id}/`} aria-label={`阅读:${item.data.title}`}>
<div class="article-card__meta">
<span>{item.data.category}</span><time datetime={fmtDate(item.data.date)}>{fmtDate(item.data.date)}</time>
</div>
<div class="article-card__index">{String((currentPage - 1) * 9 + index + 1).padStart(2, "0")}</div>
<h2>{item.data.title}</h2>
<p>{item.data.excerpt}</p>
<strong>阅读全文 <span>↗</span></strong>
</a>
</article>
))}
</div>
) : <p class="article-empty">该分类暂时还没有文章。</p>}
{lastPage > 1 && (
<nav class="article-pagination" aria-label="资讯分页">
{currentPage > 1 ? <a href={pageHref(currentPage - 1)} rel="prev">←</a> : <span aria-hidden="true">←</span>}
{pages.map((page) => page === 0
? <span class="gap">…</span>
: page === currentPage
? <span class="active" aria-current="page">{page}</span>
: <a href={pageHref(page)}>{page}</a>
)}
{currentPage < lastPage ? <a href={pageHref(currentPage + 1)} rel="next">→</a> : <span aria-hidden="true">→</span>}
</nav>
)}
---
import Base from "../layouts/Base.astro";
import Header from "./Header.astro";
import Footer from "./Footer.astro";
import ArticleListing from "./ArticleListing.astro";
import { site } from "../data/site";
import { PAGE_SIZE, type Article, type CategoryInfo } from "../lib/articles";
interface Props { items: Article[]; categories: CategoryInfo[]; totalCount: number; activeSlug: string | null; activeName: string | null; currentPage: number; lastPage: number; basePath: string; }
const { items, categories, totalCount, activeSlug, activeName, currentPage, lastPage, basePath } = Astro.props as Props;
const heading = activeName ?? "洞察中心";
const pageSuffix = currentPage > 1 ? `|第${currentPage}页` : "";
const title = `${heading}${pageSuffix}|${site.brand.name}`;
const description = activeName ? `智引未来${activeName}分类文章,分享GEO、SMO、AI搜索与品牌内容建设的实用洞察。` : "智引未来洞察中心:关于GEO、SMO、AI搜索可见度与品牌内容资产的持续观察。";
const keywords = [heading, "GEO洞察", "SMO增长", "AI搜索", "品牌内容", site.brand.name];
const pageUrl = new URL(`${basePath}${currentPage > 1 ? `/page/${currentPage}` : ""}/`, Astro.site).href;
const jsonLd = [{ "@context": "https://schema.org", "@type": "CollectionPage", name: heading, description, url: pageUrl, inLanguage: "zh-CN", mainEntity: { "@type": "ItemList", itemListElement: items.map((item, index) => ({ "@type": "ListItem", position: (currentPage - 1) * PAGE_SIZE + index + 1, name: item.data.title, url: new URL(`/articles/${item.id}/`, Astro.site).href })) } }, { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [{ "@type": "ListItem", position: 1, name: "首页", item: Astro.site?.href }, { "@type": "ListItem", position: 2, name: "洞察中心", item: new URL("/articles/", Astro.site).href }, ...(activeName ? [{ "@type": "ListItem", position: 3, name: activeName, item: pageUrl }] : [])] }];
---
<Base {title} {description} {keywords} {jsonLd}><Header /><main id="main-content"><section class="page-hero article-hero"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / <a href="/articles/">洞察中心</a>{activeName && ` / ${activeName}`}</div><div class="eyebrow"><span></span>AILEAD INSIGHTS</div><h1>{heading}</h1><p>{description}</p></div></section><section class="section-pad section-muted"><div class="container"><ArticleListing {items} {categories} {totalCount} {activeSlug} {currentPage} {lastPage} {basePath} /></div></section></main><Footer /></Base>
---
import { site } from "../data/site";
interface Props { title?: string; text?: string; }
const { title = "让品牌在下一次搜索中,被准确看见", text = "告诉我们品牌、品类与关注的问题,先用一次全搜索诊断看清GEO与SMO的优先级。" } = Astro.props;
---
<section class="cta-band"><div class="container cta-band__inner" data-reveal>
<div><div class="eyebrow eyebrow--light"><span></span>START WITH A DIAGNOSIS</div><h2>{title}</h2><p>{text}</p></div>
<div class="cta-band__actions"><a class="button button--white" href="/contact/">预约品牌诊断 <span>↗</span></a><a class="text-link text-link--light" href={`tel:${site.contact.phone}`}>电话 {site.contact.phoneDisplay}</a></div>
</div></section>
---
import { site } from "../data/site";
---
<dialog class="contact-dialog" data-contact-dialog aria-labelledby="contact-dialog-title">
<div class="contact-dialog__panel">
<button class="contact-dialog__close" type="button" data-contact-dialog-close aria-label="关闭联系方式弹窗">×</button>
<div class="contact-dialog__heading">
<div class="eyebrow"><span></span>CONTACT AILEAD</div>
<h2 id="contact-dialog-title">从一次品牌诊断开始</h2>
<p>告诉我们品牌与关注的品类关键词,先看清AI搜索和社媒搜索中的真实现状。</p>
</div>
<div class="contact-dialog__grid">
<article><span>01</span><h3>电话咨询</h3><a class="contact-dialog__primary" href={`tel:${site.contact.phone}`}>{site.contact.phoneDisplay}</a><p>工作沟通与项目咨询</p></article>
<article><span>02</span><h3>联系邮箱</h3><a class="contact-dialog__primary contact-dialog__email" href={`mailto:${site.contact.email}`}>{site.contact.email}</a><p>发送品牌资料与需求说明</p></article>
<article><span>03</span><h3>公司地址</h3><address>{site.contact.address}</address></article>
<article><span>04</span><h3>官方网站</h3><a class="contact-dialog__primary contact-dialog__website" href={`https://${site.contact.website}/`}>{site.contact.website}</a><p>智引未来官方信息窗口</p></article>
</div>
</div>
</dialog>
---
import logo from "../../pic/智引未来GEO_透明背景_矢量版.svg";
import { site } from "../data/site";
---
<footer class="site-footer">
<div class="footer-glow"></div>
<div class="container footer-grid">
<div class="footer-brand">
<a href="/" class="footer-logo" aria-label="智引未来首页"><img src={logo.src} width="775" height="199" loading="lazy" alt="智引未来" /></a>
<p>科技蓝为品牌基底,增长绿为业务引擎。让企业在AI与社媒搜索中持续被看见、被理解、被推荐。</p>
<div class="footer-tags"><span>GEO</span><span>SMO</span><span>AI全域优化</span></div>
</div>
<div><h2>探索智引</h2><a href="/about/">关于我们</a><a href="/methodology/">服务方法</a><a href="/articles/">洞察中心</a><a href="/faq/">常见问题</a></div>
<div><h2>产品服务</h2>{site.services.map((item) => <a href={`/services/${item.slug}/`}>{item.name}</a>)}</div>
<div class="footer-contact"><h2>联系咨询</h2><a class="footer-phone" href={`tel:${site.contact.phone}`}>{site.contact.phoneDisplay}</a><a href={`mailto:${site.contact.email}`}>{site.contact.email}</a><address>{site.contact.address}</address><a class="footer-arrow" href="/contact/">预约品牌诊断 <span>↗</span></a></div>
</div>
<div class="container footer-bottom">
<p>© {new Date().getFullYear()} {site.brand.legalName}</p>
<p>以真实数据驱动可持续的搜索增长</p>
</div>
</footer>
---
import logo from "../../pic/智引未来GEO_透明背景_矢量版.svg";
import { site } from "../data/site";
import { categoryToSlug, getCategoryNames } from "../lib/articles";
const path = Astro.url.pathname;
const isActive = (href: string) => href === "/" ? path === "/" : path.startsWith(href);
const categoryChildren = (await getCategoryNames()).map((label) => ({ href: `/articles/topic/${categoryToSlug(label)}/`, label }));
const nav = site.nav.map((item) => item.href === "/articles/" ? { ...item, children: [{ href: "/articles/", label: "全部文章" }, ...categoryChildren] } : item);
---
<header class="site-header" data-header>
<div class="container site-header__inner">
<a class="brand" href="/" aria-label="智引未来首页"><img src={logo.src} width="775" height="199" alt="智引未来 AILEAD FUTURE" /></a>
<nav class="desktop-nav" aria-label="主导航">
<ul>{nav.map((item) => <li class="nav-item">
<a class="nav-link" href={item.href} aria-current={isActive(item.href) ? "page" : undefined}>{item.label}</a>
<div class="nav-dropdown"><ul>{item.children.map((child) => <li><a href={child.href}>{child.label}<span aria-hidden="true">↗</span></a></li>)}</ul></div>
</li>)}</ul>
</nav>
<a class="button button--small header-cta" href="/contact/">预约诊断 <span>↗</span></a>
<details class="mobile-nav">
<summary aria-label="打开导航菜单"><span></span><span></span><span></span></summary>
<nav data-mobile-nav aria-label="移动端导航">{nav.map((item) => <div class="mobile-nav__group">
<a class="mobile-nav__primary" href={item.href} aria-current={isActive(item.href) ? "page" : undefined}>{item.label}</a>
<div class="mobile-subnav">{item.children.map((child) => <a href={child.href}>{child.label}</a>)}</div>
</div>)}<a class="button" href="/contact/">预约品牌诊断</a></nav>
</details>
</div>
</header>
---
const items = ["豆包", "通义千问", "DeepSeek", "百度AI", "文心一言", "Kimi", "腾讯元宝", "抖音搜索", "小红书搜索"];
---
<div class="platform-strip" aria-label="覆盖平台">
<div class="platform-strip__track">{[...items, ...items].map((item) => <span><i></i>{item}</span>)}</div>
</div>
---
interface Props { eyebrow: string; title: string; description?: string; align?: "left" | "center"; light?: boolean; }
const { eyebrow, title, description, align = "left", light = false } = Astro.props;
---
<div class:list={["section-heading", `section-heading--${align}`, { "section-heading--light": light }]} data-reveal>
<div class="eyebrow"><span></span>{eyebrow}</div><h2>{title}</h2>{description && <p>{description}</p>}
</div>
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";
const articleSchema = z.object({
title: z.string(),
slug: z.string(),
date: z.coerce.date(),
updated: z.coerce.date(),
category: z.string(),
author: z.string(),
excerpt: z.string(),
status: z.enum(["draft", "published"]),
});
const articles = defineCollection({
loader: glob({ pattern: "**/*.md", base: "./src/content/articles" }),
schema: articleSchema,
});
const published = defineCollection({
loader: glob({ pattern: "**/*.md", base: "./src/content/published" }),
schema: articleSchema,
});
export const collections = { articles, published };
---
title: "AI友好型官网,应当先把品牌事实讲清楚"
slug: "ai-ready-website"
date: 2026-08-04
updated: 2026-08-04
category: "品牌内容"
author: "智引未来"
excerpt: "官网不仅面向访客,也承担官方信源角色。清晰的信息架构、语义结构与持续内容,比堆叠技术术语更重要。"
status: "published"
---
# AI友好型官网,应当先把品牌事实讲清楚
企业官网是品牌最稳定、最可控的信息源之一。对用户来说,它需要快速说明企业是谁、提供什么服务、如何联系;对搜索引擎与AI来说,这些信息还需要结构清晰、彼此一致。
## 先建立可靠的信息架构
品牌、服务、公司介绍、常见问题、联系方式和持续更新的文章中心,是多数企业官网的基础模块。每个模块应有明确主题,并通过合理链接形成完整关系。
## 再考虑可发现与可理解
语义化HTML、清晰标题层级、页面描述、结构化数据、站点地图与移动端性能,都会影响内容被发现和理解的效率。
真正的AI友好,不是给页面贴上“AI”标签,而是让品牌事实长期保持准确、完整、可验证。
---
title: "SMO不是泛投流:先理解社媒搜索意图"
slug: "smo-search-intent"
date: 2026-08-06
updated: 2026-08-06
category: "SMO增长"
author: "智引未来"
excerpt: "抖音和小红书搜索承接着明确的比较与决策需求。SMO的关键,是让内容真正回答用户正在搜索的问题。"
status: "published"
---
# SMO不是泛投流:先理解社媒搜索意图
推荐流解决“用户可能感兴趣什么”,搜索解决“用户此刻明确想知道什么”。两类流量的内容逻辑并不相同。
## 搜索内容要匹配决策阶段
同一个品类下,用户可能在寻找基础知识、比较方案、验证口碑或确认购买。内容若只重复品牌口号,很难承接这些具体需求。
SMO需要先识别品类词、场景词、问题词和品牌词,再判断每类搜索背后的决策阶段,规划对应的内容形式和信息深度。
## 排名只是结果之一
有效的社媒搜索优化还要关注点击后的承接:标题是否准确、内容是否可信、品牌信息是否完整、用户能否顺利进入下一步。
因此,排名、点击、内容表现与转化线索需要放在同一个复盘框架中观察。
---
title: "GEO是什么:品牌为什么需要面向AI回答做优化"
slug: "what-is-geo"
date: 2026-08-08
updated: 2026-08-08
category: "GEO洞察"
author: "智引未来"
excerpt: "从网页排名到AI回答,品牌可见度的判断方式正在改变。本文说明GEO解决什么问题,以及企业应从哪里开始。"
status: "published"
---
# GEO是什么:品牌为什么需要面向AI回答做优化
过去,用户通常从搜索结果列表中寻找网页;现在,越来越多问题会先得到一段由AI组织的回答。品牌是否被提及、被如何描述、引用了哪些来源,都会影响用户接下来的判断。
## GEO关注的不是单一排名
GEO是生成式引擎优化。它关注品牌能否进入AI回答、信息是否准确、被推荐时处于什么语境,以及相关结论能否回到可信来源。
这意味着企业不能只优化某一个页面,而要同时建设清晰的品牌知识、覆盖用户真实问题,并让官方信息保持一致、可理解和可验证。
## 从一次可见度诊断开始
适合的第一步不是立刻大量生产内容,而是先回答三个问题:
1. 用户会在哪些问题中寻找你的品类?
2. 当前AI回答里出现了谁,引用了什么?
3. 品牌缺少的是事实、内容,还是可信来源?
有了基线,后续的知识建设、内容发布与效果监测才有明确方向。
[
"GEO洞察",
"SMO增长",
"AI搜索",
"品牌内容"
]
---
title: "AI友好型官网,应当先把品牌事实讲清楚"
slug: "ai-ready-website"
date: 2026-08-04
updated: 2026-08-04
category: "品牌内容"
author: "智引未来"
excerpt: "官网不仅面向访客,也承担官方信源角色。清晰的信息架构、语义结构与持续内容,比堆叠技术术语更重要。"
status: "published"
---
# AI友好型官网,应当先把品牌事实讲清楚
企业官网是品牌最稳定、最可控的信息源之一。对用户来说,它需要快速说明企业是谁、提供什么服务、如何联系;对搜索引擎与AI来说,这些信息还需要结构清晰、彼此一致。
## 先建立可靠的信息架构
品牌、服务、公司介绍、常见问题、联系方式和持续更新的文章中心,是多数企业官网的基础模块。每个模块应有明确主题,并通过合理链接形成完整关系。
## 再考虑可发现与可理解
语义化HTML、清晰标题层级、页面描述、结构化数据、站点地图与移动端性能,都会影响内容被发现和理解的效率。
真正的AI友好,不是给页面贴上“AI”标签,而是让品牌事实长期保持准确、完整、可验证。
---
title: "SMO不是泛投流:先理解社媒搜索意图"
slug: "smo-search-intent"
date: 2026-08-06
updated: 2026-08-06
category: "SMO增长"
author: "智引未来"
excerpt: "抖音和小红书搜索承接着明确的比较与决策需求。SMO的关键,是让内容真正回答用户正在搜索的问题。"
status: "published"
---
# SMO不是泛投流:先理解社媒搜索意图
推荐流解决“用户可能感兴趣什么”,搜索解决“用户此刻明确想知道什么”。两类流量的内容逻辑并不相同。
## 搜索内容要匹配决策阶段
同一个品类下,用户可能在寻找基础知识、比较方案、验证口碑或确认购买。内容若只重复品牌口号,很难承接这些具体需求。
SMO需要先识别品类词、场景词、问题词和品牌词,再判断每类搜索背后的决策阶段,规划对应的内容形式和信息深度。
## 排名只是结果之一
有效的社媒搜索优化还要关注点击后的承接:标题是否准确、内容是否可信、品牌信息是否完整、用户能否顺利进入下一步。
因此,排名、点击、内容表现与转化线索需要放在同一个复盘框架中观察。
---
title: "GEO是什么:品牌为什么需要面向AI回答做优化"
slug: "what-is-geo"
date: 2026-08-08
updated: 2026-08-08
category: "GEO洞察"
author: "智引未来"
excerpt: "从网页排名到AI回答,品牌可见度的判断方式正在改变。本文说明GEO解决什么问题,以及企业应从哪里开始。"
status: "published"
---
# GEO是什么:品牌为什么需要面向AI回答做优化
过去,用户通常从搜索结果列表中寻找网页;现在,越来越多问题会先得到一段由AI组织的回答。品牌是否被提及、被如何描述、引用了哪些来源,都会影响用户接下来的判断。
## GEO关注的不是单一排名
GEO是生成式引擎优化。它关注品牌能否进入AI回答、信息是否准确、被推荐时处于什么语境,以及相关结论能否回到可信来源。
这意味着企业不能只优化某一个页面,而要同时建设清晰的品牌知识、覆盖用户真实问题,并让官方信息保持一致、可理解和可验证。
## 从一次可见度诊断开始
适合的第一步不是立刻大量生产内容,而是先回答三个问题:
1. 用户会在哪些问题中寻找你的品类?
2. 当前AI回答里出现了谁,引用了什么?
3. 品牌缺少的是事实、内容,还是可信来源?
有了基线,后续的知识建设、内容发布与效果监测才有明确方向。
This diff is collapsed.
---
import "../styles/global.css";
import logo from "../../pic/智引未来GEO_透明背景_矢量版.svg";
import favicon from "../../pic/智引未来GEO_原始版本_渐变背景.png";
import { getImage } from "astro:assets";
import { site } from "../data/site";
import ContactDialog from "../components/ContactDialog.astro";
interface Props {
title: string;
description?: string;
keywords?: string | readonly string[];
image?: string;
imageAlt?: string;
ogType?: "website" | "article";
noindex?: boolean;
publishedTime?: string;
modifiedTime?: string;
articleSection?: string;
articleAuthor?: string;
jsonLd?: Record<string, unknown> | Record<string, unknown>[];
}
const {
title,
description = site.seo.description,
keywords = site.seo.keywords,
image = "/og-cover.svg",
imageAlt = site.seo.imageAlt,
ogType = "website",
noindex = false,
publishedTime,
modifiedTime,
articleSection,
articleAuthor,
jsonLd = [],
} = Astro.props;
const cleanMeta = (value: string) => value.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
const metaTitle = cleanMeta(title);
const metaDescription = cleanMeta(description);
const metaKeywords = (typeof keywords === "string" ? keywords.split(",") : keywords)
.map((keyword) => cleanMeta(keyword))
.filter(Boolean)
.join(",");
const optimizedLogo = await getImage({ src: logo, width: 420, format: "png" });
const optimizedFavicon = await getImage({ src: favicon, width: 128, height: 128, format: "png" });
const canonical = new URL(Astro.url.pathname, Astro.site).href;
const ogImage = new URL(image, Astro.site).href;
const organizationLd = {
"@context": "https://schema.org",
"@type": ["ProfessionalService", "Organization"],
"@id": new URL("/#organization", Astro.site).href,
name: site.brand.name,
alternateName: [site.brand.englishName],
legalName: site.brand.legalName,
url: new URL("/", Astro.site).href,
logo: new URL(optimizedLogo.src, Astro.site).href,
slogan: site.brand.tagline,
description: site.home.subhead,
telephone: site.contact.phone,
email: site.contact.email,
address: {
"@type": "PostalAddress",
streetAddress: site.contact.address,
addressLocality: site.contact.locality,
addressRegion: site.contact.region,
addressCountry: "CN",
},
};
const websiteLd = {
"@context": "https://schema.org",
"@type": "WebSite",
"@id": new URL("/#website", Astro.site).href,
url: new URL("/", Astro.site).href,
name: site.brand.name,
alternateName: site.brand.englishName,
inLanguage: "zh-CN",
publisher: { "@id": new URL("/#organization", Astro.site).href },
};
const webPageLd = {
"@context": "https://schema.org",
"@type": "WebPage",
"@id": `${canonical}#webpage`,
url: canonical,
name: metaTitle,
description: metaDescription,
inLanguage: "zh-CN",
isPartOf: { "@id": new URL("/#website", Astro.site).href },
about: { "@id": new URL("/#organization", Astro.site).href },
primaryImageOfPage: { "@type": "ImageObject", url: ogImage, caption: imageAlt },
};
const pageLd = Array.isArray(jsonLd) ? jsonLd : [jsonLd];
const allLd = [organizationLd, websiteLd, webPageLd, ...pageLd.filter((item) => Object.keys(item).length > 0)];
const serializedLd = JSON.stringify(allLd).replace(/</g, "\\u003c");
---
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#FFFFFF" />
<meta name="color-scheme" content="light" />
<title>{metaTitle}</title>
<meta name="description" content={metaDescription} />
<meta name="keywords" content={metaKeywords} />
<meta name="robots" content={noindex ? "noindex,nofollow" : "index,follow,max-image-preview:large,max-snippet:-1,max-video-preview:-1"} />
<link rel="canonical" href={canonical} />
<link rel="icon" href={optimizedFavicon.src} type="image/png" sizes="128x128" />
<link rel="apple-touch-icon" href={optimizedFavicon.src} />
<link rel="manifest" href="/site.webmanifest" />
<link rel="alternate" hreflang="zh-CN" href={canonical} />
<link rel="alternate" hreflang="x-default" href={canonical} />
<meta property="og:type" content={ogType} />
<meta property="og:title" content={metaTitle} />
<meta property="og:description" content={metaDescription} />
<meta property="og:url" content={canonical} />
<meta property="og:image" content={ogImage} />
<meta property="og:image:alt" content={imageAlt} />
<meta property="og:site_name" content={site.brand.name} />
<meta property="og:locale" content="zh_CN" />
{publishedTime && <meta property="article:published_time" content={publishedTime} />}
{modifiedTime && <meta property="article:modified_time" content={modifiedTime} />}
{articleSection && <meta property="article:section" content={articleSection} />}
{articleAuthor && <meta property="article:author" content={articleAuthor} />}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={metaTitle} />
<meta name="twitter:description" content={metaDescription} />
<meta name="twitter:image" content={ogImage} />
<script type="application/ld+json" set:html={serializedLd} is:inline></script>
</head>
<body>
<a class="skip-link" href="#main-content">跳到主要内容</a>
<slot />
<ContactDialog />
<script is:inline>
const header = document.querySelector('[data-header]');
const syncHeader = () => header?.classList.toggle('is-scrolled', window.scrollY > 12);
addEventListener('scroll', syncHeader, { passive: true }); syncHeader();
const observer = 'IntersectionObserver' in window ? new IntersectionObserver((entries) => entries.forEach((entry) => {
if (entry.isIntersecting) { entry.target.classList.add('is-visible'); observer.unobserve(entry.target); }
}), { threshold: 0.08 }) : null;
document.querySelectorAll('[data-reveal]').forEach((el) => observer ? observer.observe(el) : el.classList.add('is-visible'));
document.querySelectorAll('[data-mobile-nav] a').forEach((link) => link.addEventListener('click', () => link.closest('details')?.removeAttribute('open')));
const contactDialog = document.querySelector('[data-contact-dialog]');
const isMobileDevice = () => matchMedia('(max-width: 760px), (hover: none) and (pointer: coarse)').matches;
document.addEventListener('click', (event) => {
const trigger = event.target.closest('[data-open-contact]');
const phoneLink = event.target.closest('a[href^="tel:"]');
if (!contactDialog || (!trigger && (!phoneLink || isMobileDevice()))) return;
event.preventDefault();
contactDialog.showModal();
});
contactDialog?.querySelector('[data-contact-dialog-close]')?.addEventListener('click', () => contactDialog.close());
contactDialog?.addEventListener('click', (event) => { if (event.target === contactDialog) contactDialog.close(); });
</script>
</body>
</html>
This diff is collapsed.
import { getCategoryNames as readCategoryNames, getPublishedArticles as readPublishedArticles, type Article } from "./article-store";
export type { Article };
export const PAGE_SIZE = 9;
const CATEGORY_SLUGS: Record<string, string> = {
GEO洞察: "geo-insights",
SMO增长: "smo-growth",
AI搜索: "ai-search",
品牌内容: "brand-content",
};
function fallbackSlug(category: string): string {
const ascii = category.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
if (ascii) return ascii;
let hash = 0;
for (const char of category) hash = (hash * 31 + (char.codePointAt(0) ?? 0)) >>> 0;
return `c${hash.toString(36)}`;
}
export const categoryToSlug = (category: string) => CATEGORY_SLUGS[category] ?? fallbackSlug(category);
export function slugToCategory(slug: string, categories: string[]): string | undefined {
return categories.find((category) => categoryToSlug(category) === slug);
}
export async function getPublishedArticles(): Promise<Article[]> {
return readPublishedArticles();
}
export async function getCategoryNames(): Promise<string[]> {
return readCategoryNames();
}
export interface CategoryInfo {
name: string;
slug: string;
count: number;
}
export function getCategories(items: Article[], categoryNames: string[] = []): CategoryInfo[] {
const counts = new Map<string, number>(categoryNames.map((name) => [name, 0]));
for (const item of items) counts.set(item.data.category, (counts.get(item.data.category) ?? 0) + 1);
return [...counts.entries()]
.map(([name, count]) => ({ name, slug: categoryToSlug(name), count }))
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name, "zh-CN"));
}
export const lastPageOf = (total: number, pageSize = PAGE_SIZE) => Math.max(1, Math.ceil(total / pageSize));
export const pageSlice = <T>(items: T[], page: number, pageSize = PAGE_SIZE) => items.slice((page - 1) * pageSize, page * pageSize);
export const fmtDate = (date: Date) => date.toISOString().slice(0, 10);
export function paginationWindow(current: number, last: number, span = 2): number[] {
const pages = new Set<number>([1, last]);
for (let page = current - span; page <= current + span; page++) if (page >= 1 && page <= last) pages.add(page);
const sorted = [...pages].sort((a, b) => a - b);
const result: number[] = [];
let previous = 0;
for (const page of sorted) {
if (previous && page - previous > 1) result.push(0);
result.push(page);
previous = page;
}
return result;
}
This diff is collapsed.
import crypto from "node:crypto";
import fs from "node:fs/promises";
import path from "node:path";
const ROOT = process.cwd();
const DATA_ROOT = process.env.CMS_DATA_DIR ? path.resolve(process.env.CMS_DATA_DIR) : path.join(ROOT, ".runtime");
const AUTH_DIR = path.join(DATA_ROOT, "auth");
const PASSWORD_FILE = path.join(AUTH_DIR, "password.json");
const ENV_PASSWORD = process.env.CMS_PASSWORD || "admin";
const HASH_LENGTH = 64;
const SCRYPT_OPTIONS = { N: 16384, r: 8, p: 1, maxmem: 32 * 1024 * 1024 };
type PasswordState = {
version: 1;
salt: string;
hash: string;
sessionVersion: number;
updatedAt: string;
};
const safeEqual = (leftValue: unknown, rightValue: unknown): boolean => {
const left = Buffer.from(String(leftValue));
const right = Buffer.from(String(rightValue));
return left.length === right.length && crypto.timingSafeEqual(left, right);
};
async function readPasswordState(): Promise<PasswordState | null> {
try {
const parsed = JSON.parse(await fs.readFile(PASSWORD_FILE, "utf8")) as Partial<PasswordState>;
if (parsed.version !== 1 || typeof parsed.salt !== "string" || typeof parsed.hash !== "string" || !Number.isInteger(parsed.sessionVersion)) {
throw new Error("后台密码文件格式无效");
}
return parsed as PasswordState;
} catch (error) {
if ((error as NodeJS.ErrnoException).code === "ENOENT") return null;
throw error;
}
}
async function hashPassword(password: string, salt: Buffer): Promise<Buffer> {
return new Promise((resolve, reject) => {
crypto.scrypt(password, salt, HASH_LENGTH, SCRYPT_OPTIONS, (error, derivedKey) => {
if (error) reject(error);
else resolve(derivedKey);
});
});
}
export async function verifyPassword(password: unknown): Promise<boolean> {
// Check the .env credential first so it remains a recovery password even if
// the optional persisted password file is missing or damaged.
if (safeEqual(password || "", ENV_PASSWORD)) return true;
const state = await readPasswordState();
if (!state) return false;
const hash = await hashPassword(String(password || ""), Buffer.from(state.salt, "base64"));
return safeEqual(hash.toString("base64"), state.hash);
}
export async function currentSessionVersion(): Promise<number> {
try {
return (await readPasswordState())?.sessionVersion || 0;
} catch (error) {
// Keep .env login and recovery available if the optional file is corrupt.
console.error("读取后台密码文件失败:", error);
return 0;
}
}
export async function savePassword(password: string): Promise<void> {
const previous = await readPasswordState().catch(() => null);
const salt = crypto.randomBytes(16);
const hash = await hashPassword(password, salt);
const state: PasswordState = {
version: 1,
salt: salt.toString("base64"),
hash: hash.toString("base64"),
sessionVersion: (previous?.sessionVersion || 0) + 1,
updatedAt: new Date().toISOString(),
};
await fs.mkdir(AUTH_DIR, { recursive: true, mode: 0o700 });
const temporaryFile = `${PASSWORD_FILE}.${process.pid}.${crypto.randomBytes(6).toString("hex")}.tmp`;
try {
await fs.writeFile(temporaryFile, `${JSON.stringify(state, null, 2)}\n`, { mode: 0o600, flag: "wx" });
await fs.rename(temporaryFile, PASSWORD_FILE);
} catch (error) {
await fs.rm(temporaryFile, { force: true }).catch(() => {});
throw error;
}
}
import mammoth from "mammoth";
import TurndownService from "turndown";
import { gfm } from "turndown-plugin-gfm";
import { StoreError } from "./article-store";
export const MAX_WORD_FILE_SIZE = 20 * 1024 * 1024;
const DOCX_MIME = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
const ACCEPTED_DOCX_MIMES = new Set([DOCX_MIME, "application/octet-stream", "application/zip"]);
const IMAGE_MIME_ALIASES: Record<string, string> = {
"image/jpg": "image/jpeg",
"image/x-png": "image/png",
};
const SUPPORTED_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/webp", "image/gif"]);
export interface WordImportResult {
body: string;
suggestedTitle: string;
imageCount: number;
warnings: string[];
}
export function decodeWordDataUrl(dataUrl: unknown, fileName: unknown): Buffer {
const name = String(fileName || "").trim();
if (/\.doc$/i.test(name)) throw new StoreError("仅支持 .docx 文件,不支持旧版 .doc 格式");
if (!/\.docx$/i.test(name)) throw new StoreError("请选择 .docx 文件");
const match = String(dataUrl || "").match(/^data:([^;,]+);base64,([a-zA-Z0-9+/=\s]+)$/s);
if (!match || !ACCEPTED_DOCX_MIMES.has(match[1].toLowerCase())) {
throw new StoreError("Word 文件格式不正确,请上传 .docx 文件");
}
const buffer = Buffer.from(match[2].replace(/\s/g, ""), "base64");
if (!buffer.length || buffer.subarray(0, 2).toString("ascii") !== "PK") {
throw new StoreError("Word 文件无效或已经损坏");
}
if (buffer.length > MAX_WORD_FILE_SIZE) throw new StoreError("Word 文件不能超过 20MB", 413);
return buffer;
}
function titleFromFileName(fileName: string): string {
return fileName
.replace(/^.*[\\/]/, "")
.replace(/\.docx$/i, "")
.replace(/[_-]+/g, " ")
.trim() || "Word 导入文章";
}
function plainHeading(value: string): string {
return value
.replace(/!\[[^\]]*\]\([^)]*\)/g, "")
.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1")
.replace(/[`*_~]/g, "")
.trim();
}
export async function convertWordToMarkdown(
buffer: Buffer,
fileName: string,
saveImage: (dataUrl: string) => Promise<string>,
): Promise<WordImportResult> {
let imageCount = 0;
let result: Awaited<ReturnType<typeof mammoth.convertToHtml>>;
try {
result = await mammoth.convertToHtml({ buffer }, {
styleMap: ["p[style-name='Title'] => h1:fresh"],
convertImage: mammoth.images.imgElement(async (image) => {
const mime = IMAGE_MIME_ALIASES[image.contentType] || image.contentType;
if (!SUPPORTED_IMAGE_MIMES.has(mime)) {
throw new StoreError(`Word 中包含不支持的图片格式:${image.contentType || "未知格式"}`);
}
const base64 = await image.readAsBase64String();
const src = await saveImage(`data:${mime};base64,${base64}`);
imageCount += 1;
return { src };
}),
});
} catch (error) {
if (error instanceof StoreError) throw error;
throw new StoreError(`Word 文件解析失败:${error instanceof Error ? error.message : "文件无效或已经损坏"}`);
}
const turndown = new TurndownService({
bulletListMarker: "-",
codeBlockStyle: "fenced",
headingStyle: "atx",
});
turndown.use(gfm);
let body = turndown.turndown(result.value).trim();
let suggestedTitle = titleFromFileName(fileName);
const firstHeading = body.match(/^#\s+(.+)$/m);
if (firstHeading && firstHeading.index !== undefined) {
suggestedTitle = plainHeading(firstHeading[1]) || suggestedTitle;
body = `${body.slice(0, firstHeading.index)}${body.slice(firstHeading.index + firstHeading[0].length)}`
.replace(/^\s+|\s+$/g, "")
.replace(/\n{3,}/g, "\n\n");
}
if (!body) throw new StoreError("Word 文件中没有可导入的正文内容");
return {
body,
suggestedTitle,
imageCount,
warnings: result.messages.map((message) => message.message),
};
}
---
import Base from "../layouts/Base.astro"; import Header from "../components/Header.astro"; import Footer from "../components/Footer.astro";
---
<Base title="页面未找到|智引未来" description="你访问的页面不存在。" noindex><Header /><main id="main-content"><section class="not-found"><div class="container" data-reveal><span>404</span><div class="eyebrow"><span></span>PAGE NOT FOUND</div><h1>这一页暂时找不到了</h1><p>可以返回首页,继续了解智引未来的GEO与SMO全域搜索服务。</p><a class="button" href="/">返回首页</a></div></section></main><Footer /></Base>
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import SectionHeading from "../../components/SectionHeading.astro";
import CTA from "../../components/CTA.astro";
import { site } from "../../data/site";
const title = `关于智引未来|${site.brand.name}`;
const description = "了解西安智引未来的公司定位、GEO与SMO双引擎业务、自研数据技术、透明服务理念与全域搜索增长愿景。";
---
<Base {title} {description}><Header /><main id="main-content">
<section class="page-hero about-hero"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / 关于我们</div><div class="eyebrow"><span></span>ABOUT AILEAD FUTURE</div><h1>搜索入口正在重构<br /><em>品牌增长需要新的坐标系</em></h1><p>{site.about.position}</p></div></section>
<section id="position" class="section-pad section-white"><div class="container about-intro-layout"><div><SectionHeading eyebrow="OUR POSITION" title={site.about.heading} /></div><div class="story-column">{site.about.story.map((paragraph, index) => <p data-reveal><span>0{index + 1}</span>{paragraph}</p>)}</div></div></section>
<section class="stat-band"><div class="container stat-grid">{site.home.stats.map((stat) => <div data-reveal><strong>{stat.value}</strong><p>{stat.label}</p></div>)}</div></section>
<section id="advantages" class="section-pad section-muted"><div class="container"><SectionHeading eyebrow="WHY AILEAD" title="让每个结论,都能回到真实证据" description="能力不止体现在算法和平台覆盖,也体现在客户能否看懂过程、验证结果并持续迭代。" /><div class="advantage-grid">{site.about.advantages.map((item, index) => <article data-reveal><span>0{index + 1}</span><div class="advantage-icon">{["⌁", "▦", "◎", "↻", "∞", "◫"][index]}</div><h3>{item.title}</h3><p>{item.desc}</p></article>)}</div></div></section>
<section id="technology" class="section-pad about-tech"><div class="container about-tech-layout"><div><SectionHeading eyebrow="SELF-DEVELOPED TECHNOLOGY" title="五项技术,贯穿数据采集到效果监测" description="以合规采集、语义解析与时序分析为基础,为双引擎服务提供稳定的数据支撑。" light /></div><div class="technology-list">{site.about.technologies.map((item, index) => <article data-reveal><span>{String(index + 1).padStart(2, "0")}</span><h3>{item}</h3><i></i></article>)}</div></div></section>
<section class="section-pad vision-section"><div class="container vision-card" data-reveal><span>AILEAD FUTURE · OUR VISION</span><blockquote>“{site.about.vision}”</blockquote><div><i></i><p>科技蓝连接AI与数据,增长绿连接优化与结果。</p></div></div></section>
<CTA />
</main><Footer /></Base>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex,nofollow" />
<title>智引未来 · 洞察内容后台</title>
<link rel="stylesheet" href="/admin/style.css" />
</head>
<body>
<section id="login" class="login hidden">
<form id="login-form" class="login-card">
<div class="brand-mark">智引</div>
<h1>洞察内容后台</h1>
<p>输入管理密码和图片验证码,管理官网文章内容。</p>
<label>管理密码<input id="password" type="password" autocomplete="current-password" required /></label>
<label>图片验证码</label>
<div class="captcha-row">
<input id="captcha" autocomplete="off" maxlength="4" inputmode="text" aria-label="图片验证码" required />
<img id="captcha-image" alt="图片验证码,点击可更换" title="看不清?点击换一张" />
</div>
<button class="primary" type="submit">登录后台</button>
<div id="login-error" class="error"></div>
</form>
</section>
<div id="app" class="hidden">
<header class="topbar">
<div><strong>智引未来</strong><span>洞察内容后台</span></div>
<div class="top-actions">
<span id="pending-badge" class="pending-badge hidden"></span>
<a class="button ghost" href="/articles/" target="_blank" rel="noopener">查看前台</a>
<button id="change-password" class="ghost" type="button">修改密码</button>
<button id="logout" class="ghost">退出</button>
</div>
</header>
<main id="list-view" class="view">
<div class="view-head"><div><p>CONTENT</p><h1>洞察中心</h1></div><div class="view-actions"><button id="manage-categories" class="ghost">管理分类</button><button id="import-article" class="ghost">导入文件</button><button id="new-article" class="primary">+ 新建文章</button></div></div>
<input id="article-file" class="hidden" type="file" accept=".md,.docx,text/markdown,application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<p id="import-status" class="import-status" aria-live="polite"></p>
<div id="article-list" class="article-list"></div>
</main>
<main id="edit-view" class="view hidden">
<div class="view-head editor-titlebar">
<div><button id="back" class="back-button" type="button">← 返回文章列表</button><h1 id="edit-heading">编辑文章</h1></div>
<span id="editor-status" class="status"></span>
</div>
<div id="version-note" class="version-note"></div>
<form id="edit-form">
<section class="field-panel">
<label>文章标题<input id="title" required /></label>
<div class="field-label">
<span>文章分类</span>
<div id="category-select" class="custom-select">
<input id="category" type="hidden" />
<button id="category-trigger" class="select-trigger" type="button" aria-haspopup="listbox" aria-expanded="false">
<span id="category-value"></span><span class="select-chevron" aria-hidden="true"></span>
</button>
<div id="category-menu" class="select-menu hidden">
<div id="category-options" class="select-options" role="listbox" aria-label="文章分类"></div>
<div class="category-create">
<span>添加新分类</span>
<div><input id="new-category" maxlength="20" placeholder="输入分类名称" /><button id="add-category" class="primary small" type="button">添加</button></div>
<p id="category-error" class="error"></p>
</div>
</div>
</div>
</div>
<p class="auto-meta">文章网址、摘要、作者和 SEO 信息将由系统自动生成,无需填写。</p>
</section>
<section class="editor-panel">
<div class="editor-head"><div><strong>文章正文</strong><small>右侧会自动显示预览</small></div><div><span id="upload-status"></span><button id="upload-button" class="ghost small" type="button">插入图片</button></div></div>
<input id="file" class="hidden" type="file" accept="image/png,image/jpeg,image/webp,image/gif" />
<div class="editor-grid"><textarea id="body" required spellcheck="false" placeholder="在这里撰写文章正文……"></textarea><div id="preview" class="preview" aria-live="polite"></div></div>
</section>
<div class="edit-actions">
<button class="ghost save-button" type="submit">保存草稿</button>
<button id="publish" class="primary" type="button">发布到官网</button>
<details id="more-actions" class="more-actions hidden">
<summary>更多操作</summary>
<div class="action-menu">
<button id="discard" class="menu-action hidden" type="button">放弃未发布修改</button>
<button id="unpublish" class="menu-action danger hidden" type="button">下架文章</button>
<button id="delete-article" class="menu-action danger hidden" type="button">删除文章</button>
</div>
</details>
<span id="message"></span>
</div>
</form>
</main>
</div>
<div id="category-modal" class="modal hidden">
<div class="modal-card category-manager">
<div class="modal-head"><div><strong>文章分类管理</strong><small>重命名会同步更新该分类下的文章</small></div><button id="close-category-modal" class="ghost small" type="button">关闭</button></div>
<div class="category-manager-body">
<div class="manager-create"><input id="manager-new-category" maxlength="20" placeholder="输入新分类名称" /><button id="manager-add-category" class="primary" type="button">添加分类</button></div>
<p id="manager-category-error" class="error"></p>
<div id="category-manager-list" class="category-manager-list"></div>
</div>
</div>
</div>
<div id="password-modal" class="modal hidden">
<div class="modal-card password-card">
<div class="modal-head"><div><strong>修改后台密码</strong><small>修改成功后需要使用新密码重新登录</small></div><button id="close-password-modal" class="ghost small" type="button">关闭</button></div>
<form id="password-form" class="password-form">
<label>当前密码<input id="current-password" type="password" autocomplete="current-password" required /></label>
<label>新密码<input id="new-password" type="password" autocomplete="new-password" minlength="5" maxlength="128" required /></label>
<label>确认新密码<input id="confirm-password" type="password" autocomplete="new-password" minlength="5" maxlength="128" required /></label>
<p class="password-hint">新密码至少 5 个字符。</p>
<p id="password-error" class="error"></p>
<div class="password-actions"><button id="cancel-password" class="ghost" type="button">取消</button><button class="primary" type="submit">确认修改</button></div>
</form>
</div>
</div>
<div id="build-modal" class="modal hidden">
<div class="modal-card build-card">
<div><strong id="build-title">正在处理</strong><button id="close-modal" class="ghost small hidden" type="button">关闭</button></div>
<pre id="build-log">系统正在更新官网,请稍候。</pre>
</div>
</div>
<script is:inline src="/admin/app.js"></script>
</body>
</html>
import type { APIRoute } from "astro";
import { handleCmsApi } from "../../../lib/cms-api";
export const prerender = false;
const handler: APIRoute = ({ request, params, clientAddress }) =>
handleCmsApi(request, params.route || "", clientAddress);
export const GET = handler;
export const POST = handler;
export const PUT = handler;
export const PATCH = handler;
export const DELETE = handler;
---
import Base from "../../layouts/Base.astro"; import Header from "../../components/Header.astro"; import Footer from "../../components/Footer.astro"; import { site } from "../../data/site"; import { getPublishedArticle, getPublishedArticles } from "../../lib/article-store"; import { fmtDate } from "../../lib/articles";
type ArticleDetail = NonNullable<Awaited<ReturnType<typeof getPublishedArticle>>>;
export async function getStaticPaths() { const articles = await getPublishedArticles(); return Promise.all(articles.map(async (article) => ({ params: { slug: article.id }, props: { entry: await getPublishedArticle(article.id) } }))); }
const { entry } = Astro.props as { entry: ArticleDetail }; const article = entry.data; const date = fmtDate(article.date); const title = `${article.title}|洞察中心|${site.brand.name}`; const pageUrl = new URL(`/articles/${entry.id}/`, Astro.site).href;
const modified = fmtDate(article.updated || article.date);
const keywords = [article.category, article.title, "GEO", "SMO", site.brand.name];
const jsonLd = [{ "@context": "https://schema.org", "@type": "Article", headline: article.title, description: article.excerpt, datePublished: date, dateModified: modified, articleSection: article.category, inLanguage: "zh-CN", author: { "@type": "Organization", name: article.author }, publisher: { "@id": new URL("/#organization", Astro.site).href }, mainEntityOfPage: { "@type": "WebPage", "@id": `${pageUrl}#webpage` }, url: pageUrl }, { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [{ "@type": "ListItem", position: 1, name: "首页", item: Astro.site?.href }, { "@type": "ListItem", position: 2, name: "洞察中心", item: new URL("/articles/", Astro.site).href }, { "@type": "ListItem", position: 3, name: article.title, item: pageUrl }] }];
---
<Base {title} description={article.excerpt} {keywords} ogType="article" publishedTime={date} modifiedTime={modified} articleSection={article.category} articleAuthor={article.author} {jsonLd}><Header /><main id="main-content" class="article-detail-page"><article><header class="article-detail-head"><div class="article-detail-head__mesh"></div><div class="container article-detail-head__inner"><div class="breadcrumb"><a href="/">首页</a> / <a href="/articles/">洞察中心</a> / {article.category}</div><span class="article-detail-category">{article.category}</span><h1>{article.title}</h1><p>{article.excerpt}</p><div class="article-detail-meta"><time datetime={date}>{date}</time><span>{article.author}</span></div></div></header><div class="container article-detail-layout"><aside><a href="/articles/">← 返回洞察中心</a><p>持续关注GEO、SMO、AI搜索与品牌内容资产建设。</p></aside><div class="article-prose" set:html={entry.html}></div></div></article></main><Footer /></Base>
---
import ArticlesView from "../../components/ArticlesView.astro";
import { getPublishedArticles, getCategoryNames, getCategories, pageSlice, lastPageOf } from "../../lib/articles";
const all = await getPublishedArticles();
const categories = getCategories(all, await getCategoryNames());
const items = pageSlice(all, 1);
---
<ArticlesView items={items} categories={categories} totalCount={all.length} activeSlug={null} activeName={null} currentPage={1} lastPage={lastPageOf(all.length)} basePath="/articles" />
---
import ArticlesView from "../../../components/ArticlesView.astro";
import { getPublishedArticles, getCategoryNames, getCategories, pageSlice, lastPageOf } from "../../../lib/articles";
export async function getStaticPaths() {
const articles = await getPublishedArticles();
return Array.from({ length: Math.max(0, lastPageOf(articles.length) - 1) }, (_, index) => ({
params: { page: String(index + 2) },
}));
}
const all = await getPublishedArticles();
const page = Number(Astro.params.page);
---
<ArticlesView items={pageSlice(all, page)} categories={getCategories(all, await getCategoryNames())} totalCount={all.length} activeSlug={null} activeName={null} currentPage={page} lastPage={lastPageOf(all.length)} basePath="/articles" />
---
import ArticlesView from "../../../../components/ArticlesView.astro";
import { categoryToSlug, getPublishedArticles, getCategoryNames, getCategories, slugToCategory, pageSlice, lastPageOf } from "../../../../lib/articles";
export async function getStaticPaths() {
return (await getCategoryNames()).map((categoryName) => ({
params: { slug: categoryToSlug(categoryName) },
props: { categoryName },
}));
}
const all = await getPublishedArticles();
const categories = getCategories(all, await getCategoryNames());
const categoryName = String(Astro.props.categoryName || slugToCategory(Astro.params.slug!, categories.map((item) => item.name)) || "");
const filtered = all.filter((item) => item.data.category === categoryName);
---
<ArticlesView items={pageSlice(filtered, 1)} categories={categories} totalCount={all.length} activeSlug={Astro.params.slug!} activeName={categoryName} currentPage={1} lastPage={lastPageOf(filtered.length)} basePath={`/articles/topic/${Astro.params.slug}`} />
---
import ArticlesView from "../../../../../components/ArticlesView.astro";
import { getPublishedArticles, getCategoryNames, getCategories, slugToCategory, pageSlice, lastPageOf } from "../../../../../lib/articles";
export async function getStaticPaths() {
const articles = await getPublishedArticles();
const categories = getCategories(articles, await getCategoryNames());
const paths: Array<{ params: { slug: string; page: string }; props: { categoryName: string } }> = [];
for (const category of categories) {
for (let page = 2; page <= lastPageOf(category.count); page += 1) {
paths.push({ params: { slug: category.slug, page: String(page) }, props: { categoryName: category.name } });
}
}
return paths;
}
const all = await getPublishedArticles();
const categories = getCategories(all, await getCategoryNames());
const categoryName = String(Astro.props.categoryName || slugToCategory(Astro.params.slug!, categories.map((item) => item.name)) || "");
const filtered = all.filter((item) => item.data.category === categoryName);
const page = Number(Astro.params.page);
---
<ArticlesView items={pageSlice(filtered, page)} categories={categories} totalCount={all.length} activeSlug={Astro.params.slug!} activeName={categoryName} currentPage={page} lastPage={lastPageOf(filtered.length)} basePath={`/articles/topic/${Astro.params.slug}`} />
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import { site } from "../../data/site";
const title = `联系我们|${site.brand.name}`;
const description = `联系智引未来,咨询GEO、SMO、AI官网搭建与内容运营服务。电话${site.contact.phone},邮箱${site.contact.email}。`;
---
<Base {title} {description}><Header /><main id="main-content">
<section class="contact-hero"><div class="contact-hero__glow"></div><div class="container contact-hero__grid"><div data-reveal><div class="breadcrumb"><a href="/">首页</a> / 联系我们</div><div class="eyebrow eyebrow--light"><span></span>CONTACT AILEAD FUTURE</div><h1>{site.contact.heading}</h1><p>{site.contact.intro}</p><div class="hero__actions"><a class="button button--white" href={`tel:${site.contact.phone}`}>电话咨询 <span>↗</span></a><a class="button button--ghost" href={`mailto:${site.contact.email}`}>发送邮件</a></div></div><div class="contact-radar" data-reveal><div class="radar-ring radar-ring--one"></div><div class="radar-ring radar-ring--two"></div><div class="radar-core"><strong>AI</strong><span>品牌诊断</span></div><i class="radar-dot radar-dot--one"></i><i class="radar-dot radar-dot--two"></i><i class="radar-dot radar-dot--three"></i></div></div></section>
<section class="section-pad section-muted"><div class="container contact-grid"><article data-reveal><span>01</span><h2>咨询电话</h2><a class="contact-big-link" href={`tel:${site.contact.phone}`}>{site.contact.phoneDisplay}</a><p>项目咨询与需求沟通</p></article><article data-reveal><span>02</span><h2>联系邮箱</h2><a class="contact-big-link contact-big-link--small" href={`mailto:${site.contact.email}`}>{site.contact.email}</a><p>可发送品牌资料与需求说明</p></article><article data-reveal><span>03</span><h2>公司地址</h2><address>{site.contact.address}</address><p>西安 · 曲江新区</p></article><article data-reveal><span>04</span><h2>内容矩阵</h2><div class="social-list">{site.contact.socials.map((name) => <strong>{name}</strong>)}</div><p>品牌动态与行业洞察</p></article></div></section>
<section class="section-pad section-white"><div class="container visit-grid"><div><div class="eyebrow"><span></span>BEFORE WE TALK</div><h2>准备这些信息,<br />让诊断更聚焦</h2><p>无需制作复杂材料,现有品牌资料与最关心的问题就足够开始。</p></div><ol><li><span>01</span><div><strong>品牌名称与简介</strong><p>500字以内,帮助我们快速理解业务与定位</p></div></li><li><span>02</span><div><strong>5个品牌或品类关键词</strong><p>你最希望用户在哪些搜索问题中看见品牌</p></div></li><li><span>03</span><div><strong>当前主要痛点</strong><p>AI不可见、社媒排名、官网信源或内容运营</p></div></li><li><span>04</span><div><strong>联系人与官网</strong><p>便于后续沟通并快速查看现有品牌信息</p></div></li></ol></div></section>
<section class="contact-bottom"><div class="container"><p>AILEAD FUTURE · GEO × SMO</p><h2>先看清品牌可见度<br />再决定增长下一步</h2><a class="button button--white" href={`tel:${site.contact.phone}`}>立即联系 {site.contact.phoneDisplay}</a></div></section>
</main><Footer /></Base>
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import CTA from "../../components/CTA.astro";
import { site } from "../../data/site";
const title = `常见问题|${site.brand.name}`;
const description = "解答智引未来GEO与SMO的区别、覆盖平台、服务流程、技术能力、效果监测与联系方式等常见问题。";
const jsonLd = { "@context": "https://schema.org", "@type": "FAQPage", mainEntity: site.faq.map((item) => ({ "@type": "Question", name: item.q, acceptedAnswer: { "@type": "Answer", text: item.a } })) };
---
<Base {title} {description} {jsonLd}><Header /><main id="main-content">
<section class="page-hero faq-hero"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / 常见问题</div><div class="eyebrow"><span></span>FREQUENTLY ASKED</div><h1>关于GEO与SMO<br /><em>你可能想知道</em></h1><p>从服务边界、平台覆盖到效果与交付,把重要问题清楚说明。</p></div></section>
<section class="section-pad section-muted"><div class="container faq-layout"><aside data-reveal><span>01 — {String(site.faq.length).padStart(2, "0")}</span><h2>全域搜索优化 FAQ</h2><p>如果你的问题不在其中,欢迎直接联系我们做一次针对品牌现状的沟通。</p><a class="button button--outline" href="/contact/">预约咨询</a></aside><div class="faq-list">{site.faq.map((item, index) => <details data-reveal open={index === 0}><summary><span>{String(index + 1).padStart(2, "0")}</span><strong>{item.q}</strong><i aria-hidden="true"></i></summary><div><p>{item.a}</p></div></details>)}</div></div></section>
<CTA />
</main><Footer /></Base>
---
import Base from "../layouts/Base.astro";
import Header from "../components/Header.astro";
import Footer from "../components/Footer.astro";
import SectionHeading from "../components/SectionHeading.astro";
import ProductCarousel from "../components/ProductCarousel.astro";
import CTA from "../components/CTA.astro";
import { site } from "../data/site";
import { fmtDate, getPublishedArticles } from "../lib/articles";
const latest = (await getPublishedArticles()).slice(0, 3);
const title = site.seo.title;
const jsonLd = {
"@context": "https://schema.org",
"@type": "ItemList",
name: "智引未来全域搜索优化服务",
numberOfItems: site.services.length,
itemListElement: site.services.map((service, index) => ({
"@type": "ListItem",
position: index + 1,
item: {
"@type": "Service",
name: service.name,
description: service.intro,
url: new URL(`/services/${service.slug}/`, Astro.site).href,
provider: { "@id": new URL("/#organization", Astro.site).href },
},
})),
};
---
<Base {title} jsonLd={jsonLd}>
<Header />
<main id="main-content">
<section class="hero">
<div class="hero-grid-glow"></div>
<div class="container hero__grid">
<div class="hero__content" data-reveal>
<div class="hero-pill"><span></span>{site.home.eyebrow}<i>全域搜索优化</i></div>
<h1>智引未来,让品牌<br /><em>被每一个搜索看见</em></h1>
<p>{site.home.subhead}</p>
<div class="hero__actions">
<a class="button" href="/contact/">立即联系我们 <span>↗</span></a>
<a class="button button--outline" href="#solutions">了解核心能力 <span>↓</span></a>
</div>
<div class="hero__proof"><span>真实搜索数据</span><span>双引擎协同</span><span>白盒化效果</span></div>
</div>
<div class="hero-visual" data-reveal aria-label="全域搜索数据分析示意图">
<div class="visual-orbit visual-orbit--one"></div><div class="visual-orbit visual-orbit--two"></div>
<div class="search-card">
<div class="search-card__top"><div class="search-brand"><span class="search-brand__mark">AI</span><div><strong>品牌全域可见度</strong><small>实时监测概览</small></div></div><span class="live-dot">LIVE</span></div>
<div class="score-ring"><div><strong>86</strong><span>综合指数</span></div></div>
<div class="metric-list">
<div><span>AI 提及覆盖</span><i><b style="width:82%"></b></i><strong>82%</strong></div>
<div><span>引用可信度</span><i><b style="width:74%"></b></i><strong>74%</strong></div>
<div class="metric-list__green"><span>社媒搜索力</span><i><b style="width:91%"></b></i><strong>91%</strong></div>
</div>
<div class="trend-card"><div><span>搜索增长趋势</span><strong>+24.8%</strong></div><svg viewBox="0 0 320 88" role="img" aria-label="增长趋势折线"><defs><linearGradient id="area" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#19C7C4" stop-opacity=".3"/><stop offset="1" stop-color="#19C7C4" stop-opacity="0"/></linearGradient></defs><path class="trend-area" d="M2,74 C40,68 44,55 76,58 S116,74 151,49 S206,47 235,27 S278,34 318,8 L318,88 L2,88Z"/><path class="trend-line" d="M2,74 C40,68 44,55 76,58 S116,74 151,49 S206,47 235,27 S278,34 318,8"/></svg></div>
</div>
<div class="float-card float-card--geo"><span>GEO</span><div><strong>AI引用新增</strong><small>品牌知识被持续理解</small></div><b>+18</b></div>
<div class="float-card float-card--smo"><span>SMO</span><div><strong>搜索排名上升</strong><small>高价值问题持续覆盖</small></div><b>↑ 12</b></div>
</div>
</div>
<div class="container hero-platforms"><span>覆盖主流AI与社媒搜索场景</span><ProductCarousel /></div>
</section>
<section class="stat-band stat-band--light"><div class="container stat-grid">{site.home.stats.map((stat) => <div data-reveal><strong>{stat.value}</strong><p>{stat.label}</p></div>)}</div></section>
<section id="solutions" class="section-pad section-muted">
<div class="container">
<SectionHeading eyebrow="DUAL-ENGINE SOLUTION" title="一套面向企业的全域搜索获客方案" description="蓝色负责技术与GEO,绿色负责增长与SMO。两条产品线共享数据底座,可独立交付,也可组合形成全搜索覆盖。" align="center" />
<div class="engine-grid">
{site.services.slice(0, 2).map((service) => <article class:list={["engine-card", `engine-card--${service.type}`]} data-reveal>
<div class="engine-card__head"><span class="service-index">{service.index}</span><span class="service-badge">{service.type.toUpperCase()}</span></div>
<div class="engine-icon" aria-hidden="true">{service.type === "geo" ? "◎" : "↗"}</div>
<p class="engine-card__kicker">{service.kicker}</p><h2>{service.name}</h2><p>{service.intro}</p>
<ul>{service.features.slice(0, 2).map((feature) => <li><span>✓</span>{feature}</li>)}</ul>
<a href={`/services/${service.slug}/`}>了解{service.type.toUpperCase()}服务 <span>↗</span></a>
</article>)}
</div>
<div class="support-service-grid">{site.services.slice(2).map((service) => <a href={`/services/${service.slug}/`} data-reveal>
<span class="service-index">{service.index}</span><div><small>{service.kicker}</small><h3>{service.name}</h3><p>{service.intro}</p></div><i>↗</i>
</a>)}</div>
</div>
</section>
<section id="technology" class="section-pad tech-section">
<div class="tech-grid-lines"></div>
<div class="container tech-layout">
<div><SectionHeading eyebrow="TECHNOLOGY FOUNDATION" title="数据不是装饰,而是每次判断的起点" description="从跨平台采集、语义溯源到时序分析,五项自研能力支撑GEO与SMO的监测、诊断和复盘。" light /><a class="text-link text-link--light" href="/about/#technology">查看自研技术 <span>↗</span></a></div>
<div class="tech-stack">{site.about.technologies.map((item, index) => <div data-reveal><span>0{index + 1}</span><strong>{item}</strong><i></i></div>)}</div>
</div>
<div class="container tech-data-row">{[
["APP + WEB", "多端真实还原"], ["LLM TRACE", "引用来源解析"], ["GEO × SMO", "双频协同建模"], ["TIME SERIES", "持续趋势洞察"],
].map(([value, label]) => <div data-reveal><strong>{value}</strong><span>{label}</span></div>)}</div>
</section>
<section id="workflow" class="section-pad section-white">
<div class="container">
<div class="section-intro-row"><SectionHeading eyebrow="VISIBLE GROWTH LOOP" title="从看见问题,到看见增长" description="监测、诊断、优化、复盘四步贯通,让每个动作都能回到数据与证据。" /><a class="text-link" href="/methodology/">了解服务方法 <span>↗</span></a></div>
<div class="workflow-grid">{site.workflow.map((item, index) => <article data-reveal><div><span>{item.number}</span><i>{index < site.workflow.length - 1 ? "→" : "✓"}</i></div><h3>{item.title}</h3><p>{item.desc}</p></article>)}</div>
</div>
</section>
<section class="section-pad scenario-section">
<div class="container scenario-layout">
<div class="scenario-copy"><SectionHeading eyebrow="WHERE TO START" title="先从最影响增长的搜索缺口开始" description="不需要一次解决所有问题。用诊断确认优先级,再选择合适的产品与节奏。" /><a class="button button--outline" href="/contact/">预约全搜索诊断</a></div>
<div class="scenario-grid">{[
["01", "AI里搜不到品牌", "了解品牌为什么没有进入回答,以及缺少哪些可信信息。", "geo"],
["02", "AI回答被竞品占据", "分析决策问题与引用来源,找到品牌进入推荐的路径。", "geo"],
["03", "抖音/小红书排名靠后", "识别真实搜索需求,重构内容矩阵与问题覆盖。", "smo"],
["04", "官网内容难被理解", "完善语义结构、品牌知识与结构化信息,建立官方信源。", "platform"],
].map(([num, title, desc, type]) => <article class={`scenario-card scenario-card--${type}`} data-reveal><span>{num}</span><h3>{title}</h3><p>{desc}</p></article>)}</div>
</div>
</section>
{latest.length > 0 && <section class="section-pad section-white"><div class="container"><div class="section-intro-row"><SectionHeading eyebrow="AILEAD INSIGHTS" title="搜索增长洞察" description="关于GEO、SMO、AI品牌可见度与内容资产建设的持续观察。" /><a class="text-link" href="/articles/">查看全部文章 <span>↗</span></a></div><div class="article-grid">{latest.map((item, index) => <article class="article-card" data-reveal><a href={`/articles/${item.id}/`}><div class="article-card__meta"><span>{item.data.category}</span><time>{fmtDate(item.data.date)}</time></div><div class="article-card__index">0{index + 1}</div><h2>{item.data.title}</h2><p>{item.data.excerpt}</p><strong>阅读全文 ↗</strong></a></article>)}</div></div></section>}
<CTA />
</main>
<Footer />
</Base>
---
return Astro.redirect("/methodology/", 301);
---
import type { APIRoute } from "astro";
import { site } from "../data/site";
import { getPublishedArticles } from "../lib/articles";
export const prerender = true;
export const GET: APIRoute = async ({ site: configuredSite }) => {
const articles = await getPublishedArticles();
const origin = configuredSite ?? new URL("https://www.zhiyintec.com");
const url = (pathname: string) => new URL(pathname, origin).href;
const lines = [
`# ${site.brand.name}${site.brand.englishName})完整站点内容`, "", `> ${site.brand.tagline}`, "",
`官方网站:${url("/")}`, `企业主体:${site.brand.legalName}`, `咨询电话:${site.contact.phone}`, `联系邮箱:${site.contact.email}`, `公司地址:${site.contact.address}`, "",
"## 品牌与服务概览", "", site.home.subhead, "", ...site.about.story, "",
"## 核心能力数据", "", ...site.home.stats.map((stat) => `- ${stat.label}${stat.value}`), "",
"## 产品服务", "", `服务总览:${url("/services/")}`, "",
...site.services.flatMap((service) => [
`### ${service.name}`, "", `页面:${url(`/services/${service.slug}/`)}`, "", service.intro, "", "服务特点:", ...service.features.map((feature) => `- ${feature}`), "", "核心能力:", ...service.capabilities.map((capability) => `- ${capability.label}${capability.value}`), "",
]),
"## 自研技术", "", ...site.about.technologies.map((technology) => `- ${technology}`), "",
"## 服务闭环", "", ...site.workflow.map((step) => `- ${step.title}${step.desc}`), "",
"## 常见问题", "", `常见问题页面:${url("/faq/")}`, "", ...site.faq.flatMap((item) => [`### ${item.q}`, "", item.a, ""]),
"## 洞察中心全文", "", ...articles.flatMap((article) => [`### ${article.data.title}`, "", `页面:${url(`/articles/${article.id}/`)}`, `分类:${article.data.category}`, `作者:${article.data.author}`, `发布日期:${article.data.date.toISOString().slice(0, 10)}`, `更新时间:${article.data.updated.toISOString().slice(0, 10)}`, "", article.data.excerpt, "", article.body, ""]),
"## 联系方式", "", `联系页面:${url("/contact/")}`, `咨询电话:${site.contact.phone}`, `联系邮箱:${site.contact.email}`, `公司地址:${site.contact.address}`, `内容矩阵:${site.contact.socials.join("、")}`, "",
];
return new Response(lines.join("\n"), { headers: { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "public, max-age=3600" } });
};
import type { APIRoute } from "astro";
import { site } from "../data/site";
import { getPublishedArticles } from "../lib/articles";
export const prerender = true;
export const GET: APIRoute = async ({ site: configuredSite }) => {
const articles = await getPublishedArticles();
const origin = configuredSite ?? new URL("https://www.zhiyintec.com");
const url = (pathname: string) => new URL(pathname, origin).href;
const lines = [
`# ${site.brand.name}`,
"",
`> ${site.brand.tagline}`,
"",
site.about.position,
"",
"## 核心页面",
`- [首页](${url("/")})`,
`- [产品服务](${url("/services/")})`,
...site.services.map((service) => `- [${service.name}](${url(`/services/${service.slug}/`)}): ${service.seoDescription}`),
`- [关于智引未来](${url("/about/")})`,
`- [服务方法](${url("/methodology/")})`,
`- [洞察中心](${url("/articles/")})`,
`- [常见问题](${url("/faq/")})`,
`- [联系我们](${url("/contact/")})`,
"",
"## 最新洞察",
...articles.map((article) => `- [${article.data.title}](${url(`/articles/${article.id}/`)}): ${article.data.excerpt}`),
"",
`- [完整站点内容](${url("/llms-full.txt")})`,
"", `咨询电话:${site.contact.phone}`, `联系邮箱:${site.contact.email}`, `公司地址:${site.contact.address}`,
];
return new Response(lines.join("\n"), { headers: { "Content-Type": "text/plain; charset=utf-8", "Cache-Control": "public, max-age=3600" } });
};
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import SectionHeading from "../../components/SectionHeading.astro";
import CTA from "../../components/CTA.astro";
import { site } from "../../data/site";
const title = `服务方法|${site.brand.name}`;
const description = "了解智引未来从监测、诊断、优化到复盘的标准化服务闭环,以及GEO与SMO项目的透明交付方式。";
---
<Base {title} {description}><Header /><main id="main-content">
<section class="page-hero methodology-hero"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / 服务方法</div><div class="eyebrow"><span></span>OUR METHODOLOGY</div><h1>不做无法解释的黑盒<br /><em>让每一步都有证据</em></h1><p>以真实搜索数据为起点,把复杂的品牌可见度问题拆解为清晰、可执行、可复盘的服务流程。</p></div></section>
<section id="workflow" class="section-pad section-white"><div class="container"><SectionHeading eyebrow="VISIBLE GROWTH LOOP" title="四步形成持续优化闭环" description="每一轮复盘都会成为下一轮监测和策略的输入,品牌搜索资产因此持续累积。" align="center" /><div class="method-flow">{site.workflow.map((item, index) => <article data-reveal><div><span>{item.number}</span><i>{index < site.workflow.length - 1 ? "→" : "↻"}</i></div><h2>{item.title}</h2><p>{item.desc}</p></article>)}</div></div></section>
<section id="delivery" class="section-pad delivery-section"><div class="container delivery-layout"><div><SectionHeading eyebrow="TRANSPARENT DELIVERY" title="过程看得见,结果可回溯" description="项目交付不仅是一份结论,更包含结论背后的数据、证据与下一步行动。" light /></div><div class="delivery-grid">{[
["01", "现状诊断", "品牌提及、排名、竞品与问题覆盖的基线结果"], ["02", "策略地图", "平台、问题、内容与优先级的可执行规划"], ["03", "内容资产", "可进入官网、AI与社媒场景的品牌知识内容"], ["04", "效果看板", "趋势变化、阶段结果与可回溯证据持续呈现"],
].map(([num, title, desc]) => <article data-reveal><span>{num}</span><h3>{title}</h3><p>{desc}</p></article>)}</div></div></section>
<section class="section-pad section-muted"><div class="container"><SectionHeading eyebrow="SERVICE PRINCIPLES" title="三条贯穿项目的服务原则" align="center" /><div class="principle-grid">{[
["真实", "优先使用可验证的搜索数据与用户可见结果,避免依赖模糊估算。"], ["透明", "说明为什么得出结论、为什么采取动作,以及结果如何判断。"], ["持续", "不以一次排名或单篇内容为终点,长期积累品牌知识与搜索权重。"],
].map(([title, desc], index) => <article data-reveal><span>0{index + 1}</span><h3>{title}</h3><p>{desc}</p></article>)}</div></div></section>
<CTA />
</main><Footer /></Base>
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import CTA from "../../components/CTA.astro";
import { site } from "../../data/site";
export function getStaticPaths() {
return site.services.map((service) => ({ params: { slug: service.slug }, props: { service } }));
}
type Service = (typeof site.services)[number];
const { service } = Astro.props as { service: Service };
const pageUrl = new URL(`/services/${service.slug}/`, Astro.site).href;
const jsonLd = [{
"@context": "https://schema.org", "@type": "Service", "@id": `${pageUrl}#service`, name: service.name,
serviceType: service.name, description: service.seoDescription, url: pageUrl,
provider: { "@id": new URL("/#organization", Astro.site).href }, areaServed: { "@type": "Country", name: "中国" },
}, { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [{ "@type": "ListItem", position: 1, name: "首页", item: new URL("/", Astro.site).href }, { "@type": "ListItem", position: 2, name: "产品服务", item: new URL("/services/", Astro.site).href }, { "@type": "ListItem", position: 3, name: service.name, item: pageUrl }] }];
const related = site.services.filter((item) => item.slug !== service.slug);
---
<Base title={service.seoTitle} description={service.seoDescription} keywords={service.seoKeywords} {jsonLd}>
<Header /><main id="main-content">
<section class:list={["service-hero", `service-hero--${service.type}`]}><div class="service-hero__grid"></div><div class="container service-hero__inner"><div data-reveal><div class="breadcrumb"><a href="/">首页</a> / <a href="/services/">产品服务</a> / {service.name}</div><div class="service-hero__tag"><span>{service.index}</span>{service.kicker}</div><h1>{service.name}<br /><em>{service.intro}</em></h1><div class="hero__actions"><a class:list={["button", { "button--green": service.type === "smo" }]} href="/contact/">预约服务咨询 <span>↗</span></a><a class="button button--outline" href="#capabilities">查看核心能力</a></div></div>
<div class="service-hero-console" data-reveal><div class="console-top"><i></i><i></i><i></i><span>AILEAD / {service.type.toUpperCase()} MONITOR</span></div><div class="console-main"><div class="console-score"><span>VISIBILITY</span><strong>{service.type === "smo" ? "91" : "86"}</strong><small>实时示意</small></div><div class="console-chart">{[48, 62, 54, 73, 69, 84, 92].map((height, index) => <i style={`height:${height}%`}><span>0{index + 1}</span></i>)}</div></div><div class="console-foot">{service.capabilities.map((item) => <span><i></i>{item.label}</span>)}</div></div>
</div></section>
<section id="capabilities" class="section-pad section-muted"><div class="container service-cap-layout"><div><div class="eyebrow"><span></span>WHAT WE DELIVER</div><h2>把复杂的搜索问题<br />拆成可执行的能力模块</h2><p>{service.seoDescription}</p></div><div class="service-cap-grid">{service.capabilities.map((capability, index) => <article data-reveal><span>0{index + 1}</span><h3>{capability.label}</h3><p>{capability.value}</p></article>)}</div></div></section>
<section class="section-pad section-white"><div class="container service-feature-layout"><div class={`service-symbol service-symbol--${service.type}`} data-reveal><span>{service.type.toUpperCase()}</span><i></i><strong>{service.index}</strong></div><div><div class="eyebrow"><span></span>WHY IT WORKS</div><h2>以数据和内容,持续建立品牌搜索资产</h2><ul class="large-check-list">{service.features.map((feature, index) => <li data-reveal><span>0{index + 1}</span><p>{feature}</p></li>)}</ul></div></div></section>
<section class="section-pad process-section"><div class="container"><div class="section-heading section-heading--center section-heading--light" data-reveal><div class="eyebrow"><span></span>STANDARD PROCESS</div><h2>四步标准化服务流程</h2><p>每个阶段都有清晰的输入、动作与可见输出,不做无法解释的黑盒操作。</p></div><div class="process-grid">{service.process.map((step, index) => <article data-reveal><span>0{index + 1}</span><h3>{step}</h3><i>{index < service.process.length - 1 ? "→" : "✓"}</i></article>)}</div></div></section>
<nav class="related-services" aria-label="其他服务"><div class="container">{related.map((item) => <a href={`/services/${item.slug}/`}><span>{item.index}</span><strong>{item.name}</strong><i>↗</i></a>)}</div></nav>
<CTA title={`从一次${service.name}诊断开始`} text="先看清品牌现状、关键问题和优先机会,再决定适合的优化节奏。" />
</main><Footer />
</Base>
---
import Base from "../../layouts/Base.astro";
import Header from "../../components/Header.astro";
import Footer from "../../components/Footer.astro";
import SectionHeading from "../../components/SectionHeading.astro";
import CTA from "../../components/CTA.astro";
import { site } from "../../data/site";
const title = `产品服务|${site.brand.name}`;
const description = "智引未来提供GEO生成式引擎优化、SMO社媒搜索优化、AI官网搭建与公众号内容运营,帮助企业建立全域搜索获客能力。";
const keywords = site.services.flatMap((service) => service.seoKeywords);
const pageUrl = new URL("/services/", Astro.site).href;
const jsonLd = [{
"@context": "https://schema.org", "@type": "ItemList", name: "智引未来产品服务", url: pageUrl,
numberOfItems: site.services.length,
itemListElement: site.services.map((service, index) => ({ "@type": "ListItem", position: index + 1, url: new URL(`/services/${service.slug}/`, Astro.site).href, item: { "@type": "Service", name: service.name, description: service.intro, provider: { "@id": new URL("/#organization", Astro.site).href } } })),
}, { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [{ "@type": "ListItem", position: 1, name: "首页", item: new URL("/", Astro.site).href }, { "@type": "ListItem", position: 2, name: "产品服务", item: pageUrl }] }];
---
<Base {title} {description} {keywords} {jsonLd}><Header /><main id="main-content">
<section class="page-hero page-hero--services"><div class="page-hero__mesh"></div><div class="container page-hero__inner" data-reveal><div class="breadcrumb"><a href="/">首页</a> / 产品服务</div><div class="eyebrow"><span></span>PRODUCTS & SERVICES</div><h1>双引擎协同<br /><em>覆盖每一个搜索入口</em></h1><p>从AI回答到社媒搜索,从官方信源到持续内容运营,建立可监测、可优化、可复盘的全域搜索增长体系。</p></div></section>
<nav class="anchor-nav"><div class="container">{site.services.map((item) => <a href={`#${item.slug}`}><span>{item.index}</span>{item.name}</a>)}</div></nav>
<section class="section-pad section-muted"><div class="container service-list">{site.services.map((item, index) => <article id={item.slug} class:list={["service-detail", `service-detail--${item.type}`, { "service-detail--reverse": index % 2 }]}>
<div class="service-detail__visual" data-reveal>
<div class="service-visual__top"><span>{item.type.toUpperCase()}</span><small>{item.kicker}</small></div>
<div class="service-visual__core"><div><i></i><strong>{item.index}</strong></div><span>{item.name}</span></div>
<div class="service-visual__nodes">{item.capabilities.map((capability) => <span>{capability.label}<i></i></span>)}</div>
</div>
<div class="service-detail__content" data-reveal><div class="eyebrow"><span></span>{item.kicker}</div><h2>{item.name}</h2><p class="lead">{item.intro}</p><ul>{item.features.map((feature) => <li><span>✓</span>{feature}</li>)}</ul><div class="capability-pills">{item.capabilities.map((capability) => <span>{capability.label}</span>)}</div><a class:list={["button", { "button--green": item.type === "smo" }]} href={`/services/${item.slug}/`}>查看服务详情 <span>↗</span></a></div>
</article>)}</div></section>
<section class="section-pad section-white"><div class="container"><SectionHeading eyebrow="ONE SHARED DATA FOUNDATION" title="四项服务,共用一套品牌知识与数据底座" description="诊断结论可以进入内容规划,优质内容可以同时服务官网、AI与社媒搜索,让每一次投入持续复用。" align="center" /><div class="connection-map" data-reveal><span>GEO</span><span>SMO</span><strong>品牌数据底座<i></i></strong><span>AI官网</span><span>内容运营</span></div></div></section>
<CTA title="不知道先做GEO还是SMO?" text="先用一次品牌全搜索诊断识别缺口,再决定服务组合与执行顺序。" />
</main><Footer /></Base>
import type { APIRoute } from "astro";
import path from "node:path";
import fs from "node:fs/promises";
import { UPLOADS_DIR } from "../../lib/article-store";
export const prerender = false;
const MIME_TYPES: Record<string, string> = {
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".webp": "image/webp",
".gif": "image/gif",
};
export const GET: APIRoute = async ({ params }) => {
const filename = params.file || "";
if (!/^[a-zA-Z0-9._-]+$/.test(filename)) return new Response("Not Found", { status: 404 });
try {
const content = await fs.readFile(path.join(UPLOADS_DIR, filename));
return new Response(content, {
headers: {
"Content-Type": MIME_TYPES[path.extname(filename).toLowerCase()] || "application/octet-stream",
"Cache-Control": "public, max-age=31536000, immutable",
},
});
} catch {
return new Response("Not Found", { status: 404 });
}
};
This diff is collapsed.
declare module "turndown-plugin-gfm" {
import type TurndownService from "turndown";
export function gfm(service: TurndownService): void;
}
import assert from "node:assert/strict";
import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import test, { after } from "node:test";
const dataDirectory = await fs.mkdtemp(path.join(os.tmpdir(), "zhiyin-auth-"));
process.env.CMS_DATA_DIR = dataDirectory;
process.env.CMS_PASSWORD = "environment-master-password";
process.env.CMS_SECRET = "auth-test-session-secret";
process.env.CMS_API_KEY = "auth-test-api-key";
const { handleCmsApi } = await import("../src/lib/cms-api");
let requestNumber = 0;
after(async () => {
await fs.rm(dataDirectory, { recursive: true, force: true });
});
function cookieFrom(response: Response, name: string): string {
const header = response.headers.get("set-cookie") || "";
const match = header.match(new RegExp(`(?:^|,\\s*)${name}=([^;]*)`));
assert.ok(match, `missing ${name} cookie in ${header}`);
return `${name}=${match[1]}`;
}
async function login(password: string): Promise<{ response: Response; cookie?: string }> {
requestNumber += 1;
const captchaResponse = await handleCmsApi(
new Request("http://localhost/api/cms/captcha"),
"captcha",
`captcha-${requestNumber}`,
);
const code = [...(await captchaResponse.text()).matchAll(/<text\b[^>]*>([^<])<\/text>/g)]
.map((match) => match[1])
.join("");
assert.equal(code.length, 4);
const response = await handleCmsApi(new Request("http://localhost/api/cms/session", {
method: "POST",
headers: {
"Content-Type": "application/json",
Cookie: cookieFrom(captchaResponse, "cms_captcha"),
},
body: JSON.stringify({ password, captcha: code }),
}), "session", `login-${requestNumber}`);
return {
response,
cookie: response.ok ? cookieFrom(response, "cms_session") : undefined,
};
}
async function sessionStatus(cookie: string): Promise<boolean> {
const response = await handleCmsApi(new Request("http://localhost/api/cms/session", {
headers: { Cookie: cookie },
}), "session");
return Boolean((await response.json()).authed);
}
async function changePassword(cookie: string, currentPassword: string, newPassword: string): Promise<Response> {
return handleCmsApi(new Request("http://localhost/api/cms/account/password", {
method: "PUT",
headers: { "Content-Type": "application/json", Cookie: cookie },
body: JSON.stringify({ currentPassword, newPassword }),
}), "account/password");
}
test("users can change the persisted password while the .env password remains valid", async () => {
const initialLogin = await login("environment-master-password");
assert.equal(initialLogin.response.status, 200);
assert.ok(initialLogin.cookie);
const tooShort = await changePassword(initialLogin.cookie, "environment-master-password", "abcd");
assert.equal(tooShort.status, 400);
assert.match((await tooShort.json()).error, /至少需要 5 个字符/);
assert.equal(await sessionStatus(initialLogin.cookie), true);
const firstPassword = "first-user-password";
const changed = await changePassword(initialLogin.cookie, "environment-master-password", firstPassword);
assert.equal(changed.status, 200);
assert.match(changed.headers.get("set-cookie") || "", /cms_session=;/);
assert.equal((await changed.json()).requiresLogin, true);
assert.equal(await sessionStatus(initialLogin.cookie), false);
const stored = await fs.readFile(path.join(dataDirectory, "auth", "password.json"), "utf8");
assert.doesNotMatch(stored, new RegExp(firstPassword));
const userLogin = await login(firstPassword);
assert.equal(userLogin.response.status, 200);
assert.ok(userLogin.cookie);
assert.equal((await login("environment-master-password")).response.status, 200);
const secondPassword = "abcde";
const changedAgain = await changePassword(userLogin.cookie, firstPassword, secondPassword);
assert.equal(changedAgain.status, 200);
assert.equal(await sessionStatus(userLogin.cookie), false);
assert.equal((await login(firstPassword)).response.status, 401);
assert.equal((await login(secondPassword)).response.status, 200);
assert.equal((await login("environment-master-password")).response.status, 200);
});
test("an API key alone cannot change the browser login password", async () => {
const response = await handleCmsApi(new Request("http://localhost/api/cms/account/password", {
method: "PUT",
headers: {
Authorization: "Bearer auth-test-api-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
currentPassword: "environment-master-password",
newPassword: "api-key-must-not-change-this",
}),
}), "account/password");
assert.equal(response.status, 401);
});
This diff is collapsed.
This diff is collapsed.
{
"extends": "astro/tsconfigs/strict"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment