WordPress 远程新闻发布器:自动化内容工作流 - Openclaw Skills

作者:互联网

2026-04-03

AI教程

什么是 WordPress 远程新闻发布器?

此技能将您的 AI 代理转变为能够管理远程 WordPress 安装的高级新闻编辑。它利用带有公钥身份验证的 SSH 在远程服务器上安全地执行 WP-CLI 命令,无需本地安装 WordPress。通过将其集成到您的 Openclaw Skills 中,您可以自动化新闻文章的整个生命周期——从主题轮换和基于网络的事实收集到专业图像优化和 SEO 元数据配置。系统确保每篇文章都符合高编辑标准,利用多变的句子结构和经过验证的引用,同时避免常见的 AI 写作套路。

下载入口:https://github.com/openclaw/skills/tree/main/skills/promoweb/wordpress-remote-news-publisher

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install wordpress-remote-news-publisher

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 wordpress-remote-news-publisher。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

WordPress 远程新闻发布器 应用场景

  • 为利基权威博客自动化周中新闻更新。
  • 从集中式 AI 代理界面管理多个 WordPress 站点。
  • 在不牺牲新闻质量或 SEO 标准的情况下扩大内容制作规模。
  • 同步本地图像处理工作流与远程 Web 服务器。
WordPress 远程新闻发布器 工作原理
  1. 从本地轮换注册表中选择主题或接受手动输入,以确保内容覆盖的新鲜度。
  2. 使用公钥身份验证验证与远程服务器的 SSH 连接,以确保流水线畅通。
  3. 进行实时网络研究,从国际来源收集可验证的事实、数字数据和署名引用。
  4. 生成 JSON 格式的结构化文章,遵循包括导语和正文在内的高级记者编辑标准。
  5. 从 Unsplash 获取高质量图像,通过 ImageMagick 进行本地优化,并通过 SCP 传输到远程服务器。
  6. 执行远程 WP-CLI 命令以创建文章草稿、附加媒体并配置 Yoast SEO 元数据。
  7. 发布实时内容并通过 Telegram 发送成功通知,包含已发布的 URL 和字数。

WordPress 远程新闻发布器 配置指南

要将其与您的 Openclaw Skills 集成,请遵循以下安装步骤:

# 1. 生成专用的 SSH 密钥对以进行安全远程访问
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_wp -C "openclaw-wp-publisher" -N ""

# 2. 将公钥复制到您的远程 WordPress 服务器
ssh-copy-id -i ~/.ssh/id_ed25519_wp.pub -p 22 deploy@your-server-ip

# 3. 确保满足本地依赖项
# 需要 ImageMagick (convert) 和带有 requests 的 Python 3
apt install imagemagick
pip install requests

最后,在您的全局设置中配置环境变量,包括 WP_SSH_HOSTWP_SSH_KEYWP_REMOTE_PATH

WordPress 远程新闻发布器 数据架构与分类体系

该技能通过特定的文件结构和元数据分类管理其工作流:

文件 描述
config.json 存储主题列表和轮换逻辑的最后发布时间戳。
/tmp/wp_article.json 包含结构化文章组件:标题、内容、摘录、标签和 SEO 元数据。
/tmp/wp_facts.json 用于研究数据点和署名引用的临时存储。
scripts/ 用于远程发布和媒体处理的专业 Shell 和 Python 脚本目录。

Skill: WordPress Remote News Publisher

Automated news article generation and publishing to WordPress via SSH and WP-CLI.


Folder Structure

WordPress-Remote-News-Publisher/
  SKILL.md
  config.json
  scripts/
    download_cover.py
    optimize_image.sh
    upload_media_remote.sh
    publish_wp_remote.sh

Metadata

---
name: wordpress-remote-news-publisher
description: |
  Automatically generates and publishes news articles to a remote WordPress 
  installation via SSH using public key authentication. Downloads and optimizes 
  cover images from Unsplash, transfers them via SCP, and publishes articles 
  with SEO metadata (Yoast).
user-invocable: true
triggers:
  - cron: "0 10 * * 1-5"  # Weekdays at 10:00
  - cron: "0 16 * * 1-5"  # Weekdays at 16:00
  - manual: "/wordpress-remote-news-publisher [topic]"
metadata:
  emoji: "??"
  version: "1.0.0"
  author: "ClawHub Community"
  license: "MIT"
  openclaw:
    requires:
      bins:
        - ssh
        - scp
        - python3
        - curl
        - convert
      env:
        - WP_SSH_HOST
        - WP_SSH_USER
        - WP_SSH_KEY
        - WP_SSH_PORT
        - WP_REMOTE_PATH
        - WP_REMOTE_TMP
        - WP_AUTHOR_ID
        - UNSPLASH_ACCESS_KEY
---

Overview

This skill enables automated news content creation and publication to WordPress websites hosted on remote servers. It leverages SSH with public key authentication for secure, passwordless connections, and WP-CLI for all WordPress operations on the server side.

Key Features

  • Remote Execution: All WP-CLI operations run on the remote server via SSH
  • Automated Topic Selection: Round-robin rotation through configured topics
  • Journalistic Writing Style: Senior journalist quality content with lede, body, and attribution
  • Image Pipeline: Unsplash download → local optimization → SCP transfer → WordPress import
  • SEO Integration: Yoast SEO meta description and focus keyword support
  • Cron Scheduling: Automated execution on weekdays

Required Environment Variables

Variable Description Required Example
WP_SSH_HOST Remote server hostname or IP Yes 203.0.113.10 or example.com
WP_SSH_USER SSH username on remote server Yes deploy, www-data, wpcli
WP_SSH_KEY Absolute path to SSH private key Yes /home/user/.ssh/id_ed25519_wp
WP_SSH_PORT SSH port (default: 22) No 22
WP_REMOTE_PATH Absolute path to WordPress installation Yes /var/www/html/wordpress
WP_REMOTE_TMP Writable temp directory on remote No /tmp
WP_AUTHOR_ID WordPress author ID for posts Yes 1
UNSPLASH_ACCESS_KEY Unsplash API access key Yes AbC123...

Editorial Philosophy

Every article MUST adhere to these rules:

  1. Write like a senior journalist, not an AI assistant
  2. Use variable sentence length: Alternate short periods with complex constructions
  3. Lead with a clear thesis in the first paragraph (lede)
  4. Include attributed quotes from real sources when available
  5. Avoid AI-sounding phrases: Never use "it's important to note," "in the digital age," "in today's world," "in conclusion," "obviously," "clearly," or similar formulas
  6. Specific titles: No clickbait. The title must contain the main fact

Complete Procedure

Phase 1: Topic Selection

If no topic is provided as argument:

  1. Read config.json for the configured topic list
  2. Select the topic with the oldest publication date (round-robin)
  3. Use that topic for content generation

Phase 2: SSH Connection Verification

Before any operation, verify SSH connectivity:

ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" r
    -o StrictHostKeyChecking=no r
    -o BatchMode=yes r
    -o ConnectTimeout=10 r
    "$WP_SSH_USER@$WP_SSH_HOST" r
    "wp --info --path=$WP_REMOTE_PATH"

If this fails, abort and notify via Telegram with error details.

Phase 3: Research and Fact Gathering

  1. Web Search: Query "[topic] latest news [current month]" and English equivalents for international sources

  2. Fact Collection (only verifiable facts):

    • Numerical data with source attribution
    • Statements from real people with name and role
    • Specific dates and events
    • Avoid unattributed speculation
  3. Store Facts: Save to /tmp/wp_facts.json

Phase 4: Article Generation

Mandatory Editorial Structure

TITLE (max 65 characters)

  • Specific, not generic. Contains the main fact.
  • ? Good: "Meta cuts 3,600 jobs: farewell to Base AI teams"
  • ? Bad: "Meta takes important step for the future"

LEDE (first paragraph, 40-60 words)

  • Answers: Who? What? When? Where? Why?
  • The most important news in dense, precise form
  • Never starts with "In the world of..." or "In recent years..."

BODY (600-900 total words)

  • Paragraph 2: Context and background
  • Paragraphs 3-4: Main development with data and citations
  • Paragraph 5: Reactions and positions from key players
  • Paragraph 6: Implications and prospects (attributed to experts)
  • Final paragraph: Narrative closing element

META DESCRIPTION (max 155 characters) SEO TAGS (3-5 tags, without #) PRIMARY KEYWORD (1 keyword)

Output Format

Save to /tmp/wp_article.json:

{
  "title": "...",
  "content": "...",
  "excerpt": "...",
  "tags": ["..."],
  "meta_desc": "...",
  "keyword": "...",
  "topic": "..."
}

Phase 5: Cover Image

  1. Determine Visual Keyword: Derive from article topic (e.g., "server room technology")

  2. Download from Unsplash (local machine):

    python3 {baseDir}/scripts/download_cover.py '[keyword]' /tmp/cover.jpg
    
  3. Optimize Locally:

    bash {baseDir}/scripts/optimize_image.sh /tmp/cover.jpg /tmp/cover_opt.jpg
    
  4. Transfer and Import:

    bash {baseDir}/scripts/upload_media_remote.sh /tmp/cover_opt.jpg
    

    → Media ID saved to /tmp/wp_media_id.txt

Phase 6: Publishing to Remote WordPress

  1. Create Draft Post:

    bash {baseDir}/scripts/publish_wp_remote.sh
    
  2. Verify Status: Wait 30 seconds, check via SSH

  3. Publish:

    ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" "$WP_SSH_USER@$WP_SSH_HOST" r
      "wp post update $(cat /tmp/wp_post_id.txt) r
       --post_status=publish --path=$WP_REMOTE_PATH"
    
  4. Retrieve Published URL:

    ssh -i "$WP_SSH_KEY" -p "${WP_SSH_PORT:-22}" "$WP_SSH_USER@$WP_SSH_HOST" r
      "wp post get $(cat /tmp/wp_post_id.txt) --field=url --path=$WP_REMOTE_PATH"
    
  5. Send Telegram Confirmation: Title, URL, word count, keyword

Phase 7: Update Registry

Update config.json with the current timestamp for the published topic to ensure proper rotation.


SSH Key Setup (One-Time)

Before using this skill, configure public key authentication:

# 1. Generate a dedicated key pair (ed25519 recommended)
ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_wp r
    -C "openclaw-wp-publisher" -N ""

# 2. Copy public key to remote server
ssh-copy-id -i ~/.ssh/id_ed25519_wp.pub -p 22 deploy@203.0.113.10

# 3. Verify passwordless connection
ssh -i ~/.ssh/id_ed25519_wp -o BatchMode=yes r
    deploy@203.0.113.10 "wp --info"

# 4. (Optional) Restrict key in ~/.ssh/authorized_keys
command="wp --allow-root",no-port-forwarding,no-X11-forwarding r
    ssh-ed25519 AAAA... openclaw-wp-publisher

Security Tip: Use a dedicated SSH user (deploy or wpcli) with minimal server permissions. Never use root. If WP-CLI needs write access to /var/www, add the user to the www-data group.


Remote Server Requirements

Component Requirement Verification
WP-CLI Installed and in PATH wp --info
PHP ≥ 7.4 (8.x recommended) php --version
Python 3 For JSON parsing python3 --version
Permissions SSH user writes to WP_REMOTE_PATH ls -la /var/www/html/wordpress
SSH Port Open in firewall ufw status

Local Machine Requirements (OpenClaw)

Component Requirement Installation
ssh, scp In PATH Pre-installed on Linux/macOS
ImageMagick convert command apt install imagemagick
Python 3 With requests library pip install requests

Configuration Example

OpenClaw Configuration

Add to ~/.openclaw/openclaw.json:

{
  "skills": {
    "entries": {
      "wordpress-remote-news-publisher": {
        "env": {
          "WP_SSH_HOST": "203.0.113.10",
          "WP_SSH_USER": "deploy",
          "WP_SSH_KEY": "/home/user/.ssh/id_ed25519_wp",
          "WP_SSH_PORT": "22",
          "WP_REMOTE_PATH": "/var/www/html/wordpress",
          "WP_REMOTE_TMP": "/tmp",
          "WP_AUTHOR_ID": "1",
          "UNSPLASH_ACCESS_KEY": "your-unsplash-access-key"
        }
      }
    }
  },
  "cron": {
    "jobs": [
      {
        "id": "wp-morning-news",
        "schedule": "0 10 * * 1-5",
        "prompt": "Execute wordpress-remote-news-publisher. Select topic from rotation.",
        "channel": "telegram"
      },
      {
        "id": "wp-afternoon-news",
        "schedule": "0 16 * * 1-5",
        "prompt": "Execute wordpress-remote-news-publisher for afternoon edition.",
        "channel": "telegram"
      }
    ]
  }
}

Summary

This skill enables fully automated WordPress publishing without requiring WP-CLI on the local machine. All WordPress operations execute remotely via SSH, images process locally and transfer via SCP, and the connection uses public key authentication for security and automation.

相关推荐