CMS-Adapter

Integrationsleitfäden: WordPress, jede Website, Next.js, Strapi

Beginnen Sie mit den Optionen ohne Code. Der Code unten ist für Teams, die volle Kontrolle wollen.

Optionen ohne Code

  • WordPress: Öffnen Sie Integrationen, geben Sie Ihre Website-Adresse ein und bestätigen Sie die Verbindung in WordPress. Veröffentlichte Artikel erscheinen mit Titelbild, Kategorien und SEO-Beschreibung auf Ihrer Website.
  • Jede andere Website (statisches HTML, Webflow, Wix und Ähnliches): Schalten Sie in Integrationen „Jede andere Website“ ein und fügen Sie das Snippet in Ihre Blogseite ein. Kein Server, kein Speicher nötig.

Alle Adapter folgen demselben Muster: HMAC bei article.ready prüfen, vollständigen Beitrag von Tenant API v1 abrufen, dann in Ihr CMS upserten. Entwürfe sind sofort verfügbar. Sie entscheiden, wann Sie veröffentlichen.

Für Entwickler: Webhook und API

  1. API-Schlüssel + Webhook-URL in GrowthDailySeo Integrationen erstellen
  2. POST-Endpoint bereitstellen und X-GrowthDaily-Signature prüfen
  3. Bei article.ready GET /api/v1/sites/{siteId}/posts/{slug}
  4. contentHtml, seo und faqJsonLd upserten. Nach Ihrem Zeitplan veröffentlichen

Siehe auch: Webhooks · API-Referenz

Webhooks gelten nur für neue Entwürfe. Einmal GET /posts paginieren, danach updatedAfter. Wie im API-Referenz-Abschnitt zum Nachziehen.

Stack-spezifische Adapter

Kopieren, Env-Variablen und Tabellennamen anpassen, deployen.

Am einfachsten: WordPress unter Integrationen verbinden, ganz ohne Code. Den Plugin-Code unten brauchen Sie nur, wenn Sie die Synchronisierung selbst steuern wollen.

Umgebungsvariablen
# wp-config.php or server env
define('GROWTHDAILY_API_BASE', 'https://app.growthdailyseo.com');
define('GROWTHDAILY_API_KEY', 'fig_live_...');
define('GROWTHDAILY_WEBHOOK_SECRET', 'whsec_...');
define('GROWTHDAILY_SITE_ID', 'your-site-uuid');
// Tenant IndexNow — key file lives on YOUR WordPress domain (not GrowthDailySeo)
define('INDEXNOW_KEY', 'your-random-indexnow-key'); // also set in GrowthDailySeo niche_json.seo.indexnowKey
Webhook-Endpoint
<?php
// wp-content/mu-plugins/growthdaily-webhook.php
add_action('rest_api_init', function () {
  register_rest_route('growthdaily/v1', '/webhook', [
    'methods' => 'POST',
    'callback' => 'growthdaily_handle_webhook',
    'permission_callback' => '__return_true',
  ]);
});

function growthdaily_handle_webhook(WP_REST_Request $request) {
  $raw = $request->get_body();
  $ts = $request->get_header('x-growthdaily-timestamp') ?: $request->get_header('x-figrush-timestamp') ?: '';
  $sig = $request->get_header('x-growthdaily-signature') ?: $request->get_header('x-figrush-signature') ?: '';
  $expected = hash_hmac('sha256', $ts . '.' . $raw, GROWTHDAILY_WEBHOOK_SECRET);
  if (!hash_equals($expected, $sig)) {
    return new WP_Error('invalid_signature', 'Invalid signature', ['status' => 401]);
  }

  $event = json_decode($raw, true);
  if (($event['event'] ?? '') === 'article.ready') {
    growthdaily_sync_post($event['siteId'], $event['slug']);
    wp_remote_post(GROWTHDAILY_API_BASE . '/api/v1/sites/' . $event['siteId'] . '/posts/' . rawurlencode($event['slug']) . '/publish', [
      'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
      'timeout' => 15,
    ]);
  }
  return ['ok' => true];
}
Sync-Funktion (Abruf + Upsert)
function growthdaily_sync_post(string $site_id, string $slug): void {
  $url = GROWTHDAILY_API_BASE . "/api/v1/sites/{$site_id}/posts/{$slug}";
  $response = wp_remote_get($url, [
    'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
    'timeout' => 30,
  ]);
  if (is_wp_error($response)) return;

  $post = json_decode(wp_remote_retrieve_body($response), true);
  if (empty($post['slug'])) return;

  $existing = get_page_by_path($post['slug'], OBJECT, 'post');
  $post_id = wp_insert_post([
    'ID' => $existing ? $existing->ID : 0,
    'post_title' => $post['title'],
    'post_excerpt' => $post['excerpt'] ?? '',
    'post_content' => $post['contentHtml'],
    'post_status' => ($post['status'] ?? 'draft') === 'published' ? 'publish' : 'draft',
    'post_name' => $post['slug'],
  ]);

  if (!empty($post['seo']['ogTitle'])) {
    update_post_meta($post_id, '_yoast_wpseo_title', $post['seo']['ogTitle']);
  }
  if (!empty($post['seo']['metaDescription'])) {
    update_post_meta($post_id, '_yoast_wpseo_metadesc', $post['seo']['metaDescription']);
  }
  if (!empty($post['faqJsonLd'])) {
    update_post_meta($post_id, '_growthdaily_faq_jsonld', wp_json_encode($post['faqJsonLd']));
  }
  if (!empty($post['schemaBundle'])) {
    update_post_meta($post_id, '_growthdaily_schema_bundle', wp_json_encode($post['schemaBundle']));
  }
}
Render / Backfill
// Point webhook URL in GrowthDailySeo Integrations to:
// https://your-site.com/wp-json/growthdaily/v1/webhook

// Theme template — output Article + Breadcrumb + FAQ JSON-LD
function growthdaily_render_schema_bundle(int $post_id): void {
  $raw = get_post_meta($post_id, '_growthdaily_schema_bundle', true);
  if (!$raw) return;
  $bundle = json_decode($raw, true);
  if (!is_array($bundle)) return;
  foreach (['article', 'breadcrumb', 'faq'] as $key) {
    if (empty($bundle[$key])) continue;
    echo '<script type="application/ld+json">' . wp_json_encode($bundle[$key]) . '</script>';
  }
}
add_action('wp_head', function () {
  if (is_singular('post')) growthdaily_render_schema_bundle(get_the_ID());
});

// Optional: nightly backfill for missed webhooks
add_action('growthdaily_daily_sync', function () {
  $url = GROWTHDAILY_API_BASE . '/api/v1/sites/' . GROWTHDAILY_SITE_ID . '/posts?pageSize=50';
  $response = wp_remote_get($url, [
    'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
  ]);
  $items = json_decode(wp_remote_retrieve_body($response), true)['items'] ?? [];
  foreach ($items as $item) {
    growthdaily_sync_post(GROWTHDAILY_SITE_ID, $item['slug']);
  }
});
  if (!wp_next_scheduled('growthdaily_daily_sync')) {
  wp_schedule_event(time(), 'daily', 'growthdaily_daily_sync');
}
Erzeugte Seiten und llms.txt
// Fetch a generated page spec (path without leading slash)
function growthdaily_fetch_page($path) {
  $encoded = rawurlencode(ltrim($path, '/'));
  $url = GROWTHDAILY_API_BASE . '/api/v1/sites/' . GROWTHDAILY_SITE_ID . '/pages/' . $encoded;
  $response = wp_remote_get($url, [
    'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
  ]);
  return json_decode(wp_remote_retrieve_body($response), true);
}

// Proxy llms.txt onto your domain
function growthdaily_llms_txt(): string {
  $url = GROWTHDAILY_API_BASE . '/api/v1/sites/' . GROWTHDAILY_SITE_ID . '/llms.txt';
  $response = wp_remote_get($url, [
    'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
    'timeout' => 20,
  ]);
  return is_wp_error($response) ? '' : wp_remote_retrieve_body($response);
}
Sitemap-Feed
// Dynamic sitemap feed
function growthdaily_fetch_sitemap(): string {
  $url = GROWTHDAILY_API_BASE . '/api/v1/sites/' . GROWTHDAILY_SITE_ID . '/sitemap.xml';
  $response = wp_remote_get($url, [
    'headers' => ['Authorization' => 'Bearer ' . GROWTHDAILY_API_KEY],
    'timeout' => 30,
  ]);
  return is_wp_error($response) ? '' : wp_remote_retrieve_body($response);
}

// Rewrite rule or template_redirect to serve XML at /sitemap-growthdaily.xml
IndexNow-Ping
// Upload {INDEXNOW_KEY}.txt to WordPress web root (ABSPATH) — content = key string
// e.g. https://www.your-domain.com/a1b2c3.txt contains "a1b2c3"
function growthdaily_indexnow_ping(string $url): void {
  if (!defined('INDEXNOW_KEY')) return;
  wp_remote_post('https://api.indexnow.org/indexnow', [
    'headers' => ['Content-Type' => 'application/json'],
    'body' => wp_json_encode([
      'host' => wp_parse_url(home_url(), PHP_URL_HOST),
      'key' => INDEXNOW_KEY,
      'keyLocation' => home_url('/' . INDEXNOW_KEY . '.txt'),
      'urlList' => [$url],
    ]),
  ]);
}