forked from shuding/innsbruck-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle-fonts.js
31 lines (27 loc) · 856 Bytes
/
google-fonts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* Created by shuding on 5/22/16.
*/
module.exports = {
db: null,
init: _db => {
this.db = _db;
},
render: (template, options) => {
let font = options.blog.plugin ? options.blog.plugin['google-fonts'] : '';
let context = {};
if (template == 'settings') {
// settings page
context.settings =
`<div class="input-group">
<h5>Google Fonts</h5>
<p><input type="text" name="plugin.google-fonts" placeholder="Architects Daughter" value="${font}"></p>
</div>`;
}
if (font)
context.head =
`<link href='https://fonts.googleapis.com/css?family=${font}:normal,italic,semibold,semibolditalic,bold,bolditalic' rel='stylesheet' type='text/css'>
<style>body { font-family: '${font}', sans-serif }</style>`;
return context;
}
};