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
|
|
@ -137,21 +137,31 @@ def extract_wordpress_metadata(frontmatter: Dict[str, Any],
|
|||
# Status extrahieren (falls vorhanden)
|
||||
if 'status' in frontmatter:
|
||||
metadata['status'] = frontmatter['status']
|
||||
elif 'creativeWorkStatus' in frontmatter:
|
||||
# Direkt im Frontmatter (wenn #commonMetadata: als Kommentar)
|
||||
work_status = frontmatter.get('creativeWorkStatus', '').lower()
|
||||
if 'publish' in work_status:
|
||||
metadata['status'] = 'publish'
|
||||
elif work_status == 'draft':
|
||||
metadata['status'] = 'draft'
|
||||
elif isinstance(frontmatter.get('#commonMetadata'), dict):
|
||||
# Verschachtelt in #commonMetadata
|
||||
common = frontmatter['#commonMetadata']
|
||||
work_status = common.get('creativeWorkStatus', '').lower()
|
||||
if work_status == 'published':
|
||||
if 'publish' in work_status:
|
||||
metadata['status'] = 'publish'
|
||||
elif work_status == 'draft':
|
||||
metadata['status'] = 'draft'
|
||||
|
||||
# Datum extrahieren (falls vorhanden)
|
||||
# Priorität: date > datePublished > (aus commonMetadata) > (aus staticSiteGenerator)
|
||||
# Priorität: date > datePublished > (direkt) > (aus commonMetadata) > (aus staticSiteGenerator)
|
||||
if 'date' in frontmatter:
|
||||
metadata['date'] = str(frontmatter['date'])
|
||||
elif 'datePublished' in frontmatter:
|
||||
# Direkt im Frontmatter (wenn #commonMetadata: als Kommentar oder als Feld)
|
||||
metadata['date'] = str(frontmatter['datePublished'])
|
||||
elif isinstance(frontmatter.get('#commonMetadata'), dict):
|
||||
# Verschachtelt in #commonMetadata
|
||||
common = frontmatter['#commonMetadata']
|
||||
if 'datePublished' in common:
|
||||
metadata['date'] = str(common['datePublished'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue