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:
Jörg Lohrer 2025-10-01 09:22:33 +02:00
parent c269105cd0
commit 99a4a9408f
3 changed files with 47 additions and 3 deletions

View file

@ -224,12 +224,31 @@ class WordPressAPI:
if tags:
post_data['tags'] = tags
# Debug: Zeige was gesendet wird
print(f"Erstelle Beitrag mit Daten:")
print(f" - Status: {status}")
if tags:
print(f" - Tags: {tags}")
if categories:
print(f" - Kategorien: {categories}")
if 'date' in post_data:
print(f" - Datum: {post_data['date']}")
if 'date_gmt' in post_data:
print(f" - Datum GMT: {post_data['date_gmt']}")
# Beitrag erstellen
try:
response = self._post('posts', data=post_data)
post = response.json()
post_id = post['id']
print(f"Beitrag '{title}' erstellt (ID: {post_id}, Status: {status})")
print(f"✅ Beitrag '{title}' erstellt (ID: {post_id}, Status: {status})")
# Debug: Zeige was WordPress zurückgibt
if 'tags' in post and post['tags']:
print(f" WordPress-Tags: {post['tags']}")
if 'date' in post:
print(f" WordPress-Datum: {post['date']}")
return post_id
except requests.exceptions.RequestException as e: