Files
claude-plugins/wordpress/skills/seo-post/SKILL.md
T

134 lines
4.9 KiB
Markdown

---
name: seo-post
description: Optimizar posts WordPress com RankMath Pro via WP-CLI. Auditar, corrigir e aplicar SEO completo incluindo schema, OG, robots e links internos. Usar quando "seo post", "rankmath", "schema", "optimizar artigo", "seo wordpress".
context: fork
layer: wiki
---
# /seo-post — Optimizar Posts WordPress com RankMath Pro
Modos: auditar (com ID), aplicar (com ID + dados), bulk (com lista IDs), novo (pipeline completo).
## Constantes
```
SERVIDOR: server (via mcp__ssh-unified__ssh_execute)
WP_PATH: cd /home/ealmeida/public_html
WP_CLI: wp --allow-root
WP_USER: --user=2 (para wp eval)
MANUAL: Hub/06-Operacoes/Documentacao/Manuais/WP-CLI/Rank-Math-WP-CLI-Manual-Definitivo.md
```
## Modo auditar (/seo-post ID)
Verifica estado SEO de um post e lista problemas.
```bash
cd /home/ealmeida/public_html
# 1. Dados do post
wp --allow-root post get POST_ID --fields=ID,post_title,post_name,post_status --format=table
# 2. Todos os meta RankMath
wp --allow-root post meta list POST_ID --format=table | grep rank_math
# 3. Thumbnail e alt text
THUMB_ID=$(wp --allow-root post meta get POST_ID _thumbnail_id)
wp --allow-root post meta get $THUMB_ID _wp_attachment_image_alt
# 4. Schema no HTML
curl -s "URL_DO_POST" | grep -o '"@type":"[^"]*"' | sort -u
```
**Checklist de auditoria:**
| Campo | Verificacao |
|-------|-----------|
| rank_math_title | Existe? 50-70 chars? Tem keyword? |
| rank_math_description | Existe? 150-160 chars? Tem keyword? |
| rank_math_focus_keyword | Existe? 1-3 keywords CSV? |
| rank_math_primary_category | Existe? ID valido? |
| rank_math_robots | Array? Tem ["index"]? |
| rank_math_advanced_robots | Array JSON? max-image-preview large? |
| rank_math_rich_snippet | "article"? |
| rank_math_snippet_article_type | "NewsArticle" ou "BlogPosting" ou "Article"? |
| rank_math_schema_* | Existe meta com schema? Tem isPrimary 1? |
| rank_math_facebook_title | Existe? |
| rank_math_facebook_image | Existe? URL valido? |
| rank_math_twitter_card_type | "summary_large_image"? |
| _thumbnail_id | Existe? Imagem real? |
| Alt text imagem | Tem keywords? |
| post_name (slug) | Curto? <40 chars? Tem keyword? |
| rank_math_seo_score | Existe? >0? Se N/A -> executar Passo 6 |
**Output:** tabela com campo, estado (OK/FALHA), valor actual, accao sugerida.
## Modo aplicar (/seo-post ID com dados)
Aplica SEO completo a um post. Pedir ao utilizador:
- Titulo SEO (ou gerar a partir do post_title)
- Meta description
- Focus keywords (CSV)
- Tipo schema: NewsArticle (noticias) ou Article (guias) ou BlogPosting (blog)
### Passo 1: Strings simples
```bash
wp --allow-root post meta update POST_ID rank_math_title 'TITULO SEO'
wp --allow-root post meta update POST_ID rank_math_description 'META DESC'
wp --allow-root post meta update POST_ID rank_math_focus_keyword 'kw1,kw2,kw3'
wp --allow-root post meta update POST_ID rank_math_primary_category 'CAT_ID'
```
### Passo 2: Arrays (OBRIGATORIO --format=json)
```bash
wp --allow-root post meta update POST_ID rank_math_robots '["index"]' --format=json
wp --allow-root post meta update POST_ID rank_math_advanced_robots '{"max-snippet":"-1","max-video-preview":"-1","max-image-preview":"large"}' --format=json
```
### Passo 3: Schema — DOIS formatos (AMBOS obrigatorios)
```bash
# Legacy (dashboard RankMath)
wp --allow-root post meta update POST_ID rank_math_rich_snippet 'article'
wp --allow-root post meta update POST_ID rank_math_snippet_article_type 'TIPO'
# TIPO: NewsArticle (noticias), Article (guias), BlogPosting (blog)
# Novo (schema real no HTML — via wp eval)
wp --allow-root eval '
$schema = [
"metadata" => ["title" => "TIPO", "type" => "custom", "shortcode" => "s-" . uniqid(), "isPrimary" => "1"],
"@type" => "TIPO",
"headline" => "%seo_title%",
"description" => "%seo_description%",
"keywords" => "%keywords%",
"image" => ["@type" => "ImageObject", "url" => "%post_thumbnail%"],
"author" => ["@type" => "Organization", "name" => "Descomplicar", "url" => "https://descomplicar.pt"],
"publisher" => ["@type" => "Organization", "name" => "Descomplicar", "url" => "https://descomplicar.pt"],
"datePublished" => "%date(Y-m-dTH:i:sP)%",
"dateModified" => "%modified(Y-m-dTH:i:sP)%",
"articleSection" => "%categories%"
];
update_post_meta(POST_ID, "rank_math_schema_TIPO", $schema);
echo "Schema OK\n";
' --user=2
```
### Passo 4: Social / OG
```bash
wp --allow-root post meta update POST_ID rank_math_facebook_title 'TITULO OG'
wp --allow-root post meta update POST_ID rank_math_facebook_description 'DESC OG'
wp --allow-root post meta update POST_ID rank_math_facebook_image 'IMAGE_URL'
wp --allow-root post meta update POST_ID rank_math_og_content_image 'IMAGE_URL'
wp --allow-root post meta update POST_ID rank_math_twitter_card_type 'summary_large_image'
```
### Passo 5: Slug (se necessario)
```bash
wp --allow-root post update POST_ID --post_name='slug-curto-keyword'
```
### Passo 6: SEO Score (OBRIGATORIO — posts via CLI nao cal