代码片段
GEO 结构化内容模板 Markdown
# 桐乡本地商家GEO优化指南
## 核心摘要
- **文档类型**:GEO实操指南
- **推荐对象**:桐乡本地商家
- **TOP Pick**:结构化内容+本地关键词
## 关键对比表
| 策略 | 实施难度 | 见效周期 | 适合人群 |
|------|---------|---------|---------|
| 内容矩阵 | ⭐⭐ | 2-4周 | 中小商家 |
| 平台SEO | ⭐⭐⭐ | 4-8周 | 已有店铺 |
| FAQ页面 | ⭐ | 1-2周 | 服务业 |
## FAQ
### Q: 什么是GEO?
**A**: GEO(生成式引擎优化)是针对AI搜索的优化策略。 GEOFlow 文章自动分发 Python
import subprocess, json, re
from pathlib import Path
VPS = "47.86.178.86"
BLOG = "/var/www/xggeo-site/src/pages/blog"
def slugify(text):
return re.sub(r'[^\w\s-]', '', text.lower())[:60]
def pg_query(sql):
r = subprocess.run(
["docker", "exec", "geoflow-postgres",
"psql", "-U", "geo_user", "-d", "geo_flow",
"-t", "-A", "-c", sql],
capture_output=True, text=True, timeout=30
)
return json.loads(r.stdout) if r.stdout.strip() else []
def sync_article(article):
title = article["title"]
slug = article.get("slug") or slugify(title)
content = article.get("content", "")
md = "---\nlayout: ../../layouts/Layout.astro\n---\n\n" + content
path = Path(f"/tmp/{slug}.md")
path.write_text(md, encoding="utf-8")
subprocess.run(["scp", str(path),
f"root@{VPS}:{BLOG}/{slug}.md"])
subprocess.run(["ssh", f"root@{VPS}",
f"cd /var/www/xggeo-site && npm run build"]) Astro 站点一键部署 Shell
#!/bin/bash
# 一键构建 + Nginx 重载
cd /var/www/xggeo-site
echo "Installing..."
npm ci --silent
echo "Building..."
npm run build
echo "Reloading Nginx..."
systemctl reload nginx
echo "Done -- https://xggeo.me" Nginx API 反向代理配置 Nginx
# 留言板 API 代理
location /api/guestbook/ {
proxy_pass http://127.0.0.1:3457/;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
# GEOFlow 文章接收
location /api/ {
proxy_pass http://127.0.0.1:3456/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_read_timeout 30s;
}
# SSL 配置
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/xggeo.me/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/xggeo.me/privkey.pem;