[readability-js] Add article metadata on top of the page
This commit is contained in:
parent
40054ac944
commit
41dbe04fe3
|
|
@ -52,6 +52,15 @@ const HEADER = `
|
|||
h1, h2, h3 {
|
||||
line-height: 1.2;
|
||||
}
|
||||
h1.reader-title {
|
||||
font-size: 1.85em;
|
||||
line-height: 1.25em;
|
||||
width: 100%;
|
||||
margin: 0 0;
|
||||
}
|
||||
a.reader-title {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
img {
|
||||
max-width:100%;
|
||||
height:auto;
|
||||
|
|
@ -108,6 +117,9 @@ const HEADER = `
|
|||
yaDhjMS4xMSAwIDItMC44OTUgMi0ycy0wLjg5NS0yLTItMnoiIGZpbGw9IiNmZmYiLz4KPC9nPgo8L3N2Zz4K"/>
|
||||
</head>
|
||||
<body class="qute-readability">
|
||||
<h1 class="reader-title">%s</h1>
|
||||
<div>From <a class="reader-title" href=%s>%s</a></div>
|
||||
<hr>
|
||||
%s
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -134,7 +146,8 @@ else {
|
|||
getDOM(target, domOpts).then(dom => {
|
||||
let reader = new Readability(dom.window.document);
|
||||
let article = reader.parse();
|
||||
let content = util.format(HEADER, article.title, article.content);
|
||||
let subtitle = (article.siteName == null) ? new URL(process.env.QUTE_URL).hostname : article.siteName;
|
||||
let content = util.format(HEADER, article.title, article.title, process.env.QUTE_URL, subtitle, article.content);
|
||||
|
||||
fs.writeFile(tmpFile, content, (err) => {
|
||||
if (err) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue