Skip to content

Commit e22ad8f

Browse files
committed
Adds option to customize fonts and color, support for extra socials, pinterest/whatsapp share
1 parent 86555b3 commit e22ad8f

File tree

18 files changed

+514
-163
lines changed

18 files changed

+514
-163
lines changed

example/site-config.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
themeColor: "#15171A", // Used for Offline Manifest
1717
apiUrl: "https://wordpress.theasdfghjkl.com",
1818
subscribeWidget: {
19+
visible: false,
1920
title: "Subscribe to Draftbox",
2021
helpText: "Get the latest posts delivered right to your inbox.",
2122
successMessage: "Thanks for subscribing to Draftbox.",
@@ -63,6 +64,12 @@ module.exports = {
6364
instagram: "https://www.instagram.com/",
6465
linkedin: "https://linkedin.com/",
6566
github: "https://github.com/draftbox-co",
67+
whatsapp: "",
68+
pinterest: "",
69+
youtube: "",
70+
dribbble: "",
71+
behance: "",
72+
externalLink: "",
6673
},
6774
contactWidget: {
6875
title: "Contact Built with Draftbox",
@@ -95,4 +102,32 @@ module.exports = {
95102
iconUrl: "favicon.png",
96103
coverUrl: "cover.jpg",
97104
alternateLogoUrl: "logo.png",
105+
themeConfig: {
106+
fonts: [
107+
{
108+
family: "Libre Baskerville",
109+
variants: ["400", "700"],
110+
fontDisplay: "swap",
111+
strategy: "selfHosted",
112+
},
113+
],
114+
variables: [
115+
{
116+
varName: "--primary-font",
117+
value: "Libre Baskerville",
118+
},
119+
{
120+
varName: "--primary-font-normal",
121+
value: "400",
122+
},
123+
{
124+
varName: "--primary-font-bold",
125+
value: "700",
126+
},
127+
{
128+
varName: "--primary-color",
129+
value: "#404040",
130+
},
131+
],
132+
},
98133
};

gatsby-wordpress-theme-libre/gatsby-config.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = (themeOptions) => {
1313
const siteConfig = themeOptions.siteConfig || siteConfigDefaults;
1414
const wordpressConfig = themeOptions.wordpressConfig;
1515

16-
return {
16+
const configOptions = {
1717
siteMetadata: siteConfig,
1818
plugins: [
1919
/**
@@ -176,6 +176,30 @@ module.exports = (themeOptions) => {
176176
content: `Draftbox`,
177177
},
178178
},
179+
{
180+
resolve: `@draftbox-co/gatsby-plugin-css-variables`,
181+
options: {
182+
variables: siteConfig.themeConfig.variables,
183+
},
184+
},
179185
],
180186
};
187+
188+
if (siteConfig.themeConfig.fonts && siteConfig.themeConfig.fonts.length > 0) {
189+
configOptions.plugins.push({
190+
resolve: `@draftbox-co/gatsby-plugin-webfonts`,
191+
options: {
192+
fonts: {
193+
google: siteConfig.themeConfig.fonts,
194+
},
195+
formats: ["woff2", "woff"],
196+
useMinify: true,
197+
usePreload: true,
198+
usePreconnect: true,
199+
blacklist: ["/amp"],
200+
},
201+
});
202+
}
203+
204+
return configOptions;
181205
};

gatsby-wordpress-theme-libre/gatsby-node.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
255255
siteMetadata {
256256
postsPerPage
257257
siteTitle
258+
subscribeWidget {
259+
visible
260+
}
258261
}
259262
}
260263
@@ -276,6 +279,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
276279
const tags = result.data.allWordpressTag.edges;
277280
const pages = result.data.allWordpressPage.edges;
278281
const siteTitle = result.data.site.siteMetadata.siteTitle;
282+
const subscribeWidget = result.data.site.siteMetadata.subscribeWidget;
279283

280284
posts.forEach((post, i, arr) => {
281285
createPage({
@@ -285,6 +289,7 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
285289
slug: post.node.slug,
286290
next: i === arr.length - 1 ? null : arr[i + 1].node.id,
287291
prev: i !== 0 ? arr[i - 1].node.id : null,
292+
subscribeWidget: subscribeWidget,
288293
},
289294
});
290295

gatsby-wordpress-theme-libre/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
},
4848
"dependencies": {
4949
"@draftbox-co/gatsby-plugin-amp": "^0.2.4",
50+
"@draftbox-co/gatsby-plugin-css-variables": "^0.0.3",
51+
"@draftbox-co/gatsby-plugin-webfonts": "^1.1.3",
5052
"@reach/router": "^1.3.3",
5153
"disqus-react": "^1.0.8",
5254
"gatsby-awesome-pagination": "^0.3.5",

0 commit comments

Comments
 (0)