[](https://draftbox.co)
npm install @draftbox-co/gatsby-wordpress-theme-libre
bash
yarn add @draftbox-co/gatsby-wordpress-theme-libre
# or
npm install @draftbox-co/gatsby-wordpress-theme-libre --save
`
2. Create following files in your root directory with your desired config.
- Create siteConfig.js in root directory and configure it as shown below.
`js
//siteConfig.js
module.exports = {
siteUrl: "https://wp-libre-preview.draftbox.co", // Site domain. Do not include a trailing slash!
postsPerPage: 10, // Number of posts shown on paginated pages (changes this requires sometimes to delete the cache)
siteTitleMeta: "Built with Draftbox", // This allows an alternative site title for meta data for pages.
siteDescriptionMeta:
"Lightning fast, secure front-end for your WordPress or Ghost blog, without coding", // This allows an alternative site description for meta data for pages.
shareImageWidth: 1000, // Change to the width of your default share image
shareImageHeight: 523, // Change to the height of your default share image
shortTitle: "Built with Draftbox", // Used for App manifest e.g. Mobile Home Screen
siteIcon: "favicon.png", // Logo in /static dir used for SEO, RSS, and App manifest
backgroundColor: "#e9e9e9", // Used for Offline Manifest
themeColor: "#15171A", // Used for Offline Manifest
apiUrl: "https://wordpress.theasdfghjkl.com",
subscribeWidget: {
title: "Subscribe to Draftbox",
helpText: "Get the latest posts delivered right to your inbox.",
successMessage: "Thanks for subscribing to Draftbox.",
},
header: {
navigation: [
{
label: "Home",
url: "https://wp-libre-preview.draftbox.co/",
},
{
label: "Contact",
url: "https://wp-libre-preview.draftbox.co/contact",
},
],
},
footer: {
copyright: "Built with Draftbox",
navigation: [
{
label: "Home",
url: "https://wp-libre-preview.draftbox.co/",
},
{
label: "Sitemap",
url: "https://wp-libre-preview.draftbox.co/sitemap.xml",
},
{
label: "RSS",
url: "https://wp-libre-preview.draftbox.co/rss.xml",
},
{
label: "Contact",
url: "https://wp-libre-preview.draftbox.co/contact",
},
{
label: "External Link",
url: "https://spectrum.chat/gatsby-js/themes?tab=posts",
},
],
},
socialLinks: {
twitter: "https://twitter.com/draftboxhq",
facebook: "https://facebook.com/",
instagram: "https://www.instagram.com/",
linkedin: "https://linkedin.com/",
github: "https://github.com/draftbox-co",
},
contactWidget: {
title: "Contact Built with Draftbox",
successMessage: "We’ll get in touch with you soon.",
},
};
`
In the configuration shown above, the most important fields to be changed are siteUrl, siteTitleMeta and siteDescriptionMeta. Update at least those to fit your needs.
- Create .wordpress-config.json in root directory and configure it as shown below.
`bash
{
"baseUrl": "yourwordpressblog.com",
"protocol": "https",
"hostingWPCOM": false,
"useACF": true,
"includedRoutes": [
"**/categories",
"**/posts",
"**/pages",
"**/media",
"**/tags",
"**/taxonomies",
"**/users"
]
}
`
In the configuration shown above, the most important fields to be changed are baseUrl and hostingWPCOM . Update those with your configuration. example shown above works great for self hosted wordpress.
If your blog is hosted on wordpress.com you will have to add few extra keys for reference check out wordpress-source-docs.
2. Add the following configuration to your gatsby-config.js file
`js
// gatsby-config.js
let siteConfig;
let wordpressConfig;
try {
siteConfig = require(./siteConfig);
wordpressConfig = require(./.wordpress-config);
console.log(wordpressConfig);
} catch (e) {
console.log(e);
}
module.exports = {
plugins: [
{
resolve: @draftbox-co/gatsby-wordpress-theme-libre,
options: {
wordpressConfig,
siteConfig: siteConfig,
},
},
],
};
``