This repository has been archived on 2022-10-07. You can view files and clone it, but cannot push or open issues or pull requests.
skynet-webportal/packages/website/gatsby-config.js

131 lines
3.3 KiB
JavaScript
Raw Permalink Normal View History

2021-03-31 11:24:05 +00:00
const { defaultIcons } = require("gatsby-plugin-manifest/common");
if (!process.env.PORTAL_DOMAIN) {
throw new Error("PORTAL_DOMAIN cannot be empty");
}
2021-03-23 12:07:19 +00:00
module.exports = {
siteMetadata: {
2021-03-31 11:24:05 +00:00
title: `Skynet`,
description: `Skynet is a decentralized file sharing and content distribution protocol`,
2021-04-01 16:36:16 +00:00
author: `Skynet Labs`,
siteUrl: `https://${process.env.PORTAL_DOMAIN}`,
image: `/icons/icon-512x512.png`,
2021-03-23 12:07:19 +00:00
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
2021-03-25 10:44:52 +00:00
{
resolve: `gatsby-source-filesystem`,
options: {
name: `src`,
path: `${__dirname}/src/`,
},
},
2021-03-31 11:24:05 +00:00
{
resolve: `gatsby-source-filesystem`,
options: {
name: `data`,
path: `${__dirname}/data/`,
},
},
`gatsby-plugin-postcss`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-image`,
2021-03-23 12:07:19 +00:00
`gatsby-plugin-sharp`,
`gatsby-plugin-svgr`,
2021-03-31 11:24:05 +00:00
`gatsby-plugin-robots-txt`,
`gatsby-transformer-sharp`,
`gatsby-transformer-yaml`,
{
resolve: `gatsby-plugin-env-variables`,
options: {
allowList: ["PORTAL_DOMAIN", "WEBSITE_CONTACT_EMAIL", "WEBSITE_ABUSE_EMAIL"],
},
},
2021-03-23 12:07:19 +00:00
{
resolve: `gatsby-plugin-manifest`,
options: {
2021-03-31 11:24:05 +00:00
name: `Skynet`,
short_name: `Skynet`,
2021-03-23 12:07:19 +00:00
start_url: `/`,
2021-03-31 11:24:05 +00:00
background_color: `#f1f7f2`,
theme_color: `#f1f7f2`,
2021-03-23 12:07:19 +00:00
display: `minimal-ui`,
icon: `src/images/logo-sq.svg`, // This path is relative to the root of the site.
2021-03-31 11:24:05 +00:00
icons: [
...defaultIcons,
// when we're serving content from the portal on our pathnames that do not have
// favicon defined (basically all non-html content), we want the browsers to be
// able to fall back to favicon.ico (firefox does that)
{
src: `favicon.ico`,
sizes: `32x32`,
type: `image/x-icon`,
},
],
description: `Skynet portal homepage and upload widget`,
2021-03-31 11:24:05 +00:00
},
},
2022-01-11 22:08:00 +00:00
{
resolve: "gatsby-plugin-sitemap",
options: {
output: "/",
createLinkInHead: true,
excludes: ["/using-typescript/"],
query: `
{
site {
siteMetadata {
siteUrl
}
}
allSitePage {
nodes {
path
}
}
}
`,
2022-03-03 13:55:28 +00:00
resolvePages: ({ allSitePage: { nodes: allPages } }) => {
2022-01-11 22:08:00 +00:00
const pathToDateMap = {};
// modify pages to filter out hidden news items and add date
const pages = allPages
.filter((page) => {
if (pathToDateMap[page.path] && pathToDateMap[page.path].hidden) {
return false;
}
return true;
})
.map((page) => {
return { ...page, ...pathToDateMap[page.path] };
});
return pages;
},
serialize: ({ path, date }) => {
let entry = {
url: path,
changefreq: "daily",
priority: 0.5,
};
if (date) {
entry.priority = 0.7;
entry.lastmod = date;
}
return entry;
},
},
},
2021-03-23 12:07:19 +00:00
],
2021-03-25 10:44:52 +00:00
};