Fix: Frontmatter mit Hash-Kommentaren und Debug-Ausgaben
Fixes: - Unterstützung für flaches Frontmatter (wenn #commonMetadata: als Kommentar) - creativeWorkStatus direkt im Frontmatter wird jetzt erkannt - datePublished direkt im Frontmatter wird jetzt erkannt - Status 'Published' wird zu 'publish' konvertiert (mit 'publish' in lowercase) - date_gmt für explizite Datumskontrolle hinzugefügt Debug-Ausgaben: - Tag-Verarbeitung: Zeigt gefundene Tags und IDs - Post-Erstellung: Zeigt gesendete Daten (Tags, Kategorien, Datum) - WordPress-Response: Zeigt zurückgegebene Tags und Datum - Verbesserte Erfolgsmeldung mit ✅ Getestet mit content/beispiel-beitrag.md: ✅ Status: publish ✅ Datum: 2025-09-02 ✅ Tags: 6 Stück korrekt extrahiert
This commit is contained in:
parent
c269105cd0
commit
99a4a9408f
3 changed files with 47 additions and 3 deletions
15
workflow.py
15
workflow.py
|
|
@ -202,10 +202,17 @@ def process_post(wp_api: WordPressAPI, post_config: Dict[str, Any],
|
|||
tag_ids = []
|
||||
tags_list = metadata.get('tags') or post_config.get('tags') or []
|
||||
|
||||
if tags_list:
|
||||
print(f"Tags aus Frontmatter: {tags_list}")
|
||||
|
||||
for tag_name in tags_list:
|
||||
tag_id = wp_api.get_or_create_tag(tag_name)
|
||||
if tag_id:
|
||||
tag_ids.append(tag_id)
|
||||
print(f" → Tag '{tag_name}' ID: {tag_id}")
|
||||
|
||||
if tag_ids:
|
||||
print(f"Gesamt Tag-IDs: {tag_ids}")
|
||||
|
||||
# Beitragsbild verarbeiten
|
||||
featured_media_id = None
|
||||
|
|
@ -244,8 +251,16 @@ def process_post(wp_api: WordPressAPI, post_config: Dict[str, Any],
|
|||
# Wenn nur Datum (YYYY-MM-DD), füge Uhrzeit hinzu
|
||||
if len(publish_date) == 10: # Format: 2025-09-02
|
||||
publish_date = f"{publish_date}T00:00:00"
|
||||
|
||||
# Für draft-Posts: Setze sowohl 'date' als auch 'date_gmt'
|
||||
# Für published-Posts: WordPress setzt automatisch bei Veröffentlichung
|
||||
extra_fields['date'] = publish_date
|
||||
# date_gmt für explizite Kontrolle (ohne Zeitzone)
|
||||
extra_fields['date_gmt'] = publish_date
|
||||
|
||||
print(f"Veröffentlichungsdatum: {publish_date}")
|
||||
if status == 'draft':
|
||||
print(f" (Hinweis: Datum wird erst beim Veröffentlichen aktiv)")
|
||||
|
||||
# Beitrag erstellen
|
||||
skip_duplicates = global_settings.get('skip_duplicates', True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue