public void fixTitle() { string title = document.Head.QuerySelector("title").TextContent; if (!string.IsNullOrWhiteSpace(title)) { // copy title to og title PageManipulator.upsertHeadElement(document, "meta", "property", "og:title", title); // copy title to h1 PageManipulator.replaceTemplateText(document, document.QuerySelector("main article header h1"), "TitleDerived", title); } }
public void fixDescription() { string description = document.Head.QuerySelector(@"meta[name = 'Description']")?.GetAttribute(PageManipulator.CONTENT) ?? ""; // copy description to og description if (!string.IsNullOrWhiteSpace(description)) { PageManipulator.upsertHeadElement(document, "meta", "property", "og:description", description); // copy description to header p PageManipulator.replaceTemplateText(document, document.QuerySelector("main article header p"), "SubtitleDerived", description); } }