Wp2ghost/CSharpGhostImporter/GhostDto.cs
Roland 24d88e224b Importer: Kategorien als Tags, Keywords als Meta, Bilder vollständig nach Ghost
Importer
- Kategorien werden als Ghost-Tags angelegt; bei mehreren wird die primäre
  abgefragt, die übrigen folgen als sekundäre Tags
- Schlagwörter werden ohne Nachfrage als <meta name="keywords"> in den
  Code-Injection-Header geschrieben (Ghost kennt kein meta_keywords-Feld)
- Tag-Suche lädt alle Seiten, HTML-kodierte Namen werden dekodiert

Bilder
- Varianten eines WordPress-Bildes (Original, -scaled, -WxH, ?w=) werden
  zusammengefasst, einmal geladen und im HTML alle umgeschrieben
- src bei Einzelbildern setzen, srcset/sizes entfernen
- Cache-Schlüssel ist der Pfad statt nur der Dateiname; Dateinamen eindeutig
- ZIP-Export enthält Cache-Bilder und feature_image
- Warnung bei Bild-URLs, die weiter auf WordPress zeigen
- Maximale Bildgröße 2048 px

Plugin / GhostImageManager
- Plugin liefert primäre Kategorie
- Kategorie- und Keyword-Felder samt Filter im Image Manager

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 12:26:18 +02:00

41 lines
2.4 KiB
C#

using System.Text.Json.Serialization;
namespace wp2ghost
{
public class GhostRoot { [JsonPropertyName("db")] public List<GhostDb> Db { get; set; } = new() { new GhostDb() }; }
public class GhostDb { [JsonPropertyName("data")] public GhostData Data { get; set; } = new(); }
public class GhostData { [JsonPropertyName("posts")] public List<GhostPost> Posts { get; set; } = new(); }
public class GhostPost
{
[JsonPropertyName("id")] public string? Id { get; set; }
[JsonPropertyName("title")] public string? Title { get; set; }
[JsonPropertyName("slug")] public string? Slug { get; set; }
[JsonPropertyName("html")] public string? Html { get; set; }
[JsonPropertyName("markdown")] public string? Markdown { get; set; }
[JsonPropertyName("feature_image")] public string? FeatureImage { get; set; }
[JsonPropertyName("status")] public string? Status { get; set; }
[JsonPropertyName("created_at")] public string? CreatedAt { get; set; }
[JsonPropertyName("published_at")] public string? PublishedAt { get; set; }
}
public class GhostPostFile
{
[JsonPropertyName("wp_id")] public int WpId { get; set; }
[JsonPropertyName("wp_slug")] public string? WpSlug { get; set; }
[JsonPropertyName("ghost_id")] public string? GhostId { get; set; }
[JsonPropertyName("title")] public string? Title { get; set; }
[JsonPropertyName("slug")] public string? Slug { get; set; }
[JsonPropertyName("excerpt")] public string? Excerpt { get; set; }
[JsonPropertyName("status")] public string? Status { get; set; }
[JsonPropertyName("created_at")] public string? CreatedAt { get; set; }
[JsonPropertyName("published_at")] public string? PublishedAt { get; set; }
[JsonPropertyName("feature_image")] public string? FeatureImage { get; set; }
[JsonPropertyName("categories")] public List<WpCategory> Categories { get; set; } = new();
[JsonPropertyName("tags")] public List<WpCategory> Tags { get; set; } = new();
[JsonPropertyName("keywords")] public string? Keywords { get; set; }
[JsonPropertyName("comments")] public List<WpComment> Comments { get; set; } = new();
[JsonPropertyName("image_files")] public List<string> ImageFiles { get; set; } = new();
[JsonPropertyName("html")] public string? Html { get; set; }
}
}