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
32
33
34
35
|
import _ from 'lodash';
import { BenzinConfig } from './lib/types';
import nginxAdapter from './lib/nginxAdapter';
const config: BenzinConfig = {
title: `Eugene's Space`,
CDN: 'https://git.eug-vs.xyz/eug-vs/eug-vs-xyz/plain/src',
adapter: nginxAdapter,
paths: {
favicon: '/public/icon-64.png',
logo: '/public/eug-vs.png',
emojiRoot: '/public/emoji',
css: '/public/style.css?h=benzin-next-cdn',
},
hooks: {
async preRender(path, data, adapter, cdn) {
if (path.length === 1 && path[0] === 'index') {
// Inject blog preview into home page
const blog = await adapter.getMarkdownSource(cdn, ['blog', 'index']);
const previewContent = blog
.split('\n')
.filter(line => line.startsWith('-'))
.slice(0, 4)
.join('\n');
const split = data.split('# Recent blog posts');
return [split[0], '# Recent blog posts\n', previewContent, split[1]].join('');
}
return data;
}
},
};
export default config;
|