Bugfix: Tag-Duplikate, Post-Duplikate und Veröffentlichungsdatum
Fixes: - Tag/Kategorie-Erstellung: Bessere Fehlerbehandlung für bereits existierende Tags - Post-Duplikatsprüfung: Verbesserte Suche mit status='any' und case-insensitive Vergleich - Veröffentlichungsdatum: datePublished aus Frontmatter wird als WordPress-Datum gesetzt - Erweiterte Datumsextraktion aus verschiedenen Frontmatter-Strukturen Neue Datei: - USAGE_MODES.md: Übersicht der drei Verwendungsmodi
This commit is contained in:
parent
7a234be652
commit
9ba1aa7b10
4 changed files with 169 additions and 8 deletions
18
workflow.py
18
workflow.py
|
|
@ -232,6 +232,21 @@ def process_post(wp_api: WordPressAPI, post_config: Dict[str, Any],
|
|||
# Autor
|
||||
author_name = metadata.get('author') or post_config.get('author') or default_author
|
||||
|
||||
# Veröffentlichungsdatum
|
||||
# WordPress erwartet ISO 8601 Format: 2025-09-02T12:00:00
|
||||
publish_date = metadata.get('date') or post_config.get('date')
|
||||
|
||||
# Zusätzliche WordPress-Felder vorbereiten
|
||||
extra_fields = {}
|
||||
if publish_date:
|
||||
# Datum formatieren falls nötig
|
||||
if isinstance(publish_date, str):
|
||||
# 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"
|
||||
extra_fields['date'] = publish_date
|
||||
print(f"Veröffentlichungsdatum: {publish_date}")
|
||||
|
||||
# Beitrag erstellen
|
||||
skip_duplicates = global_settings.get('skip_duplicates', True)
|
||||
post_id = wp_api.create_post(
|
||||
|
|
@ -242,7 +257,8 @@ def process_post(wp_api: WordPressAPI, post_config: Dict[str, Any],
|
|||
categories=category_ids if category_ids else None,
|
||||
tags=tag_ids if tag_ids else None,
|
||||
excerpt=excerpt,
|
||||
check_duplicate=skip_duplicates
|
||||
check_duplicate=skip_duplicates,
|
||||
**extra_fields # Datum und andere Felder
|
||||
)
|
||||
|
||||
return post_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue