Put <title> and <base> in the <head> instead of <body>

This also means renderHTML() is no longer needed.
This commit is contained in:
Nate Weaver
2020-01-30 06:10:45 -06:00
parent dc4850b777
commit 447cc44b8e
6 changed files with 28 additions and 24 deletions

View File

@@ -199,6 +199,8 @@ extension DetailWebViewController: WKNavigationDelegate {
struct TemplateData: Codable {
let style: String
let body: String
let title: String
let baseURL: String
}
private extension DetailWebViewController {
@@ -227,7 +229,7 @@ private extension DetailWebViewController {
rendering = ArticleRenderer.articleHTML(article: article, extractedArticle: extractedArticle, style: style)
}
let templateData = TemplateData(style: rendering.style, body: rendering.html)
let templateData = TemplateData(style: rendering.style, body: rendering.html, title: rendering.title, baseURL: rendering.baseURL)
let encoder = JSONEncoder()
var render = "error();"

View File

@@ -1,5 +1,7 @@
<html>
<head>
<title></title>
<base href="">
<style>
</style>
<script src="main.js"></script>