-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathscully.scully-plugins.config.ts
117 lines (112 loc) · 3.36 KB
/
scully.scully-plugins.config.ts
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
import { ScullyConfig, setPluginConfig } from '@scullyio/scully';
import { SitemapConfig, getSitemapPlugin } from './dist/scully-plugin-sitemap';
import { getRegexPlugin } from './dist/scully-plugin-regex';
import { getHttp404Plugin } from './dist/scully-plugin-http404';
import { getShopifyCollectionsPlugin , getShopifyProductsPlugin} from './dist/scully-plugin-shopify';
import * as dotenv from 'dotenv';
dotenv.config();
const SitemapPlugin = getSitemapPlugin();
const sitemapConfig: SitemapConfig = {
urlPrefix: 'https://gamma.stream',
sitemapFilename: 'sitemap.xml',
merge: false,
changeFreq: 'monthly',
priority: ['1.0', '0.9', '0.8', '0.7', '0.6', '0.5', '0.4', '0.3', '0.2', '0.1', '0.0'],
ignoredRoutes: ['/404'],
routes: {
'/products/:productId': {
trailingSlash: true,
changeFreq: 'daily',
priority: '0.9',
sitemapFilename: 'sitemap-products.xml',
merge: false,
},
'/shopify-collections/:collectionHandle': {
changeFreq: 'daily',
priority: '0.9',
sitemapFilename: 'sitemap-shopify.xml',
merge: true,
},
'/shopify-collections/:collectionHandle/:id': {
changeFreq: 'daily',
priority: '0.9',
sitemapFilename: 'sitemap-shopify.xml',
merge: true,
},
'/shopify-product/:productHandle': {
changeFreq: 'daily',
priority: '0.9',
sitemapFilename: 'sitemap-shopify.xml',
merge: true,
},
}
}
setPluginConfig(SitemapPlugin, sitemapConfig);
const RegexPlugin = getRegexPlugin();
setPluginConfig(RegexPlugin, {
replacements: [{
from: 'foo',
to: 'foobar'
}, {
from: new RegExp('([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)', 'gi'),
to: '<a href="mailto:$1">$1</a>'
}],
routes: {
'/products/:productId': {
replacements: [{
from: 'foo',
to: 'foofoo'
}]
},
}
});
const Http404Plugin = getHttp404Plugin();
const shopifyConfig = {
domain: process.env.SHOPIFY_DOMAIN,
storefrontAccessToken: process.env.SHOPIFY_STOREFRONT_ACCESS_TOKEN
};
const ShopifyCollectionsPlugin = getShopifyCollectionsPlugin();
setPluginConfig(ShopifyCollectionsPlugin, shopifyConfig);
const ShopifyProductsPlugin = getShopifyProductsPlugin();
setPluginConfig(ShopifyProductsPlugin, shopifyConfig);
export const config: ScullyConfig = {
projectRoot: './src',
projectName: 'scully-plugins',
outDir: './dist/static',
defaultPostRenderers: [RegexPlugin, Http404Plugin],
routes: {
'/products/:productId': {
type: 'json',
productId: {
url: 'http://localhost:4200/assets/products.json',
property: 'id',
}
},
'/shopify-collections/:collectionHandle': {
type: ShopifyCollectionsPlugin,
query: {},
collectionHandle: {
property: 'handle'
}
},
'/shopify-collections/:collectionHandle/:id': {
type: ShopifyCollectionsPlugin,
query: {
first: 10
},
collectionHandle: {
property: 'handle'
},
id: {
property: 'id'
}
},
'/shopify-product/:productHandle': {
type: ShopifyProductsPlugin,
query: {},
productHandle: {
property: 'handle'
}
}
}
};