mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 10:47:21 +00:00
Add special case handling for feeds where the title appears in article content. Add reactormag’s feed as first of those special cases.
This commit is contained in:
1 parent
dd7d639659
commit
0937d656b6
2 files changed
+16
-1
No files matched your search
@@ -263,7 +263,12 @@ private extension ArticleRenderer {
|
||||
return d
|
||||
}
|
||||
|
||||
d["title"] = title
|
||||
// Reader view content comes from the web page, not the feed, so it keeps the title.
|
||||
if extractedArticle == nil, ArticleRenderingSpecialCases.contentIncludesTitle(feedURL: article.feed?.url) {
|
||||
d["title"] = ""
|
||||
} else {
|
||||
d["title"] = title
|
||||
}
|
||||
d["preferred_link"] = article.preferredLink ?? ""
|
||||
|
||||
if let externalLink = article.externalLink, externalLink != article.preferredLink {
|
||||
|
||||
@@ -106,6 +106,16 @@ struct ArticleRenderingSpecialCases {
|
||||
return result
|
||||
}
|
||||
|
||||
private static let feedURLsWithTitleInContent = ["https://reactormag.com/feed/"]
|
||||
|
||||
/// These feeds’ content starts with the article’s own styled title, so the article view doesn’t show a second one.
|
||||
static func contentIncludesTitle(feedURL: String?) -> Bool {
|
||||
guard let feedURL else {
|
||||
return false
|
||||
}
|
||||
return feedURLsWithTitleInContent.contains(feedURL)
|
||||
}
|
||||
|
||||
static func filterHTMLIfNeeded(baseURL: String, html: String) -> String {
|
||||
var filteredHTML = removeLocationHrefRedirectScripts(html)
|
||||
|
||||
|
||||
Reference in new issue
Block a user