diff --git a/Evergreen/MainWindow/Detail/ArticleRenderer.swift b/Evergreen/MainWindow/Detail/ArticleRenderer.swift index 53251f23b..3e082485b 100644 --- a/Evergreen/MainWindow/Detail/ArticleRenderer.swift +++ b/Evergreen/MainWindow/Detail/ArticleRenderer.swift @@ -167,6 +167,16 @@ class ArticleRenderer { if let feedURL = article.feed?.homePageURL { feedLink = linkWithTextAndClass(feedTitle, feedURL, "feedLink") } + if let feedIcon = article.feed?.iconURL { + let feedIconImage = "" + if let feedURL = article.feed?.homePageURL { + let feedIconImageLink = linkWithText(feedIconImage, feedURL) + feedLink = feedIconImageLink + " " + feedLink + } + else { + feedLink = feedIconImage + " " + feedLink + } + } } d["feedlink"] = feedLink d["feedlink_withfavicon"] = feedLink @@ -181,10 +191,27 @@ class ArticleRenderer { d["date_short"] = shortDate d["byline"] = byline() + d["author_avatar"] = authorAvatar() return d } + private func authorAvatar() -> String { + + guard let authors = article.authors, authors.count == 1, let author = authors.first else { + return "" + } + guard let avatarURL = author.avatarURL else { + return "" + } + + var imageTag = "" + if let authorURL = author.url { + imageTag = linkWithText(imageTag, authorURL) + } + return "
\(imageTag)
" + } + private func byline() -> String { guard let authors = article.authors ?? article.feed?.authors, !authors.isEmpty else { @@ -221,15 +248,8 @@ class ArticleRenderer { } } - byline = "By " + byline - if authors.count == 1, let author = authors.first { - if let avatarURL = author.avatarURL { - byline = " " + byline - } - } - - return byline + return " • " + byline } private func renderedHTML() -> String { diff --git a/Evergreen/Resources/styleSheet.css b/Evergreen/Resources/styleSheet.css index b187e62bb..f2c18fc2b 100644 --- a/Evergreen/Resources/styleSheet.css +++ b/Evergreen/Resources/styleSheet.css @@ -31,6 +31,16 @@ a:hover { #articleDescription { line-height: 1.5em; } +#authorAvatar { + margin-top: 2em; + text-align: left; +} +#authorAvatar img { + border-radius: 5px; +} +.feedIcon { + border-radius: 5px; +} h1 { line-height: 1.15em; font-weight: medium; diff --git a/Evergreen/Resources/template.html b/Evergreen/Resources/template.html index 4aaf20969..e009a1b1b 100644 --- a/Evergreen/Resources/template.html +++ b/Evergreen/Resources/template.html @@ -1,3 +1,5 @@ -
[[feedlink_withfavicon]] • [[date_medium]]
+
[[feedlink_withfavicon]] [[byline]]
+[[date_medium]]

[[newsitem_title]]

[[newsitem_description]]
+