-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgridsome.config.js
163 lines (158 loc) · 3.87 KB
/
gridsome.config.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// This is where project configuration and plugin options are located.
// Learn more: https://gridsome.org/docs/config
// Changes here require a server restart.
// To restart press CTRL + C in terminal and run `gridsome develop`
// import slugify from 'slugify';
const slugify = require('slugify');
const slugSettings = {
remove: /[*+~.,()'"!:@]/g,
};
module.exports = {
siteName: 'Puerh.wtf',
icon: {
favicon: {
src: './src/android-chrome-512x512.png',
},
touchicon: {
src: './src/apple-touch-icon.png',
precomposed: true,
},
},
templates: {
Tasting: [
{
path: (node) => {
// Split apart date & format it
const occurredOn = new Date(node.date);
const year = occurredOn.getFullYear();
const month = String(occurredOn.getMonth() + 1).padStart(2, '0');
// Get title
const slug = slugify(node.title, slugSettings);
return `/sessions/${year}/${month}/${slug}-${node.production_year}`;
},
},
],
Category: '/categories/:title',
Author: '/drinker/:title',
Style: '/categories/:category/:title',
Varietal: '/varietal/:title',
Origin: [
{
path: (node) => {
const country =
slugify(node?.country ?? '', slugSettings) ?? 'unknown';
const municipality =
slugify(node?.municipality ?? '', slugSettings) ?? 'unknown';
const location = slugify(node?.location ?? '', slugSettings);
return `/origin/${country}/${municipality}/${location}`;
},
},
],
Vendor: '/vendor/:title',
Tags: '/tags/:title',
},
transformers: {
remark: {
externalLinksTarget: '_blank',
externalLinksRel: ['nofollow', 'noopener', 'noreferrer'],
anchorClassName: 'icon icon-link',
plugins: [
// ...global plugins
],
},
},
plugins: [
{
use: 'gridsome-plugin-tailwindcss',
options: {
tailwindConfig: './tailwind.config.js',
shouldTimeTravel: true,
presetEnvConfig: {
autoprefixer: true,
},
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/tastings/*.md',
typeName: 'Tasting',
refs: {
author: 'Author',
style: 'Style',
cultivar: 'Varietal',
origin: 'Origin',
vendor: 'Vendor',
tags: 'Tags',
},
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/authors/*.md',
typeName: 'Author',
// route: '/styles/:slug',
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/categories/*.md',
typeName: 'Category',
// route: '/styles/:slug',
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/styles/*.md',
typeName: 'Style',
// route: '/styles/:slug',
refs: {
category: 'Category',
},
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/cultivars/*.md',
typeName: 'Varietal',
refs: {
style: 'Style',
},
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/origins/*.md',
typeName: 'Origin',
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/tags/*.md',
typeName: 'Tags',
},
},
{
use: '@gridsome/source-filesystem',
options: {
path: 'content/vendors/*.md',
typeName: 'Vendor',
},
},
{
use: 'gridsome-plugin-netlify-cms',
options: {
modulePath: `src/cms/index.js`,
configPath: `src/cms/config.yml`,
publicPath: `/cms`,
htmlTitle: `Tea CMS`,
},
},
],
};