mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Shorten link out URL's
This commit is contained in:
@@ -122,7 +122,11 @@ struct RedditLinkData: Codable {
|
||||
guard !host.hasSuffix("reddit.com") && !host.hasSuffix("redd.it") else {
|
||||
return ""
|
||||
}
|
||||
return "<div><a href=\"\(url)\">\(url)</a></div>"
|
||||
var displayURL = "\(urlComponents.host ?? "")\(urlComponents.path)"
|
||||
if displayURL.count > 30 {
|
||||
displayURL = "\(displayURL.prefix(30))..."
|
||||
}
|
||||
return "<div><a href=\"\(url)\">\(displayURL)</a></div>"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user