Add external_url to article header if the article is a link-blog style article. Fixes #2569

This commit is contained in:
Maurice Parker 2020-11-20 02:17:17 -06:00
parent e32c38f327
commit 6398c56511
3 changed files with 18 additions and 1 deletions

View File

@ -153,6 +153,18 @@ private extension ArticleRenderer {
let title = titleOrTitleLink() let title = titleOrTitleLink()
d["title"] = title d["title"] = title
if let externalLink = article.externalURL, externalLink != article.preferredLink {
var displayLink = externalLink.strippingHTTPOrHTTPSScheme
if displayLink.count > 40 {
displayLink = displayLink.prefix(40).appending("...")
}
let regarding = NSLocalizedString("Regarding", comment: "Regarding")
let externalLinkString = "\(regarding): <a href=\"\(externalLink)\">\(displayLink)</a>"
d["external_link"] = externalLinkString
} else {
d["external_link"] = ""
}
d["body"] = body d["body"] = body
var components = URLComponents() var components = URLComponents()

View File

@ -78,6 +78,10 @@ body > .systemMessage {
color: var(--feedlink-color); color: var(--feedlink-color);
} }
.externalLink {
font-style: italic;
}
.avatar img { .avatar img {
border-radius: 4px; border-radius: 4px;
} }

View File

@ -10,5 +10,6 @@
<article> <article>
<div class="articleTitle"><h1>[[title]]</h1></div> <div class="articleTitle"><h1>[[title]]</h1></div>
<div class="[[dateline_style]]">[[date_medium]]</div> <div class="[[dateline_style]]">[[date_medium]]</div>
<div class="externalLink">[[external_link]]</div>
<div class="articleBody">[[body]]</div> <div class="articleBody">[[body]]</div>
</article> </article>