text: const urljoin = require("url-join");
  const config = require("./config/SiteConfig");
  
  const regexExcludeRobots = /^(?!\/(dev-404-page|404|offline-plugin-app-shell-fallback|tags|categories)).*$/;
  
  module.exports = {
    pathPrefix: config.pathPrefix === "" ? "/" : config.pathPrefix,
    siteMetadata: {
      siteUrl: urljoin(config.siteUrl, config.pathPrefix),
      title: config.siteTitle,
    },
    plugins: [
      `gatsby-plugin-tslint`,
      `gatsby-plugin-typescript`,
      "gatsby-plugin-react-helmet",
      "gatsby-plugin-sass",
      "gatsby-plugin-sharp",
      "gatsby-transformer-sharp",
      {
        resolve: `gatsby-transformer-remark`,
        options: {
          plugins: [
            {
              resolve: "gatsby-remark-relative-images"
            },
            `gatsby-remark-autolink-headers`,
            `gatsby-remark-emoji-unicode`,
            {
              resolve: `gatsby-remark-prismjs`,
              options: {
                classPrefix: "language-",
                inlineCodeMarker: null,
                aliases: {},
                showLineNumbers: true,
                noInlineHighlight: false,
              },
            },
            {
              resolve: `gatsby-remark-images`,
              options: {
                maxWidth: 1280,
                linkImagesToOriginal: false,
              },
            },
            {
              resolve: `gatsby-remark-images-medium-zoom`, // point!
              options: {
                //...
              }
            },
            {
              resolve: "gatsby-remark-responsive-iframe"
            },
            "gatsby-remark-copy-linked-files",
          ],
        },
      },
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          path: `${__dirname}/gatsby-config.js`,
        },
      },
      {
        resolve: `gatsby-source-filesystem`,
        options: {
          name: `src`,
          path: `${__dirname}/src/`,
        },
      },
      {
        resolve: "gatsby-source-filesystem",
        options: {
          name: "assets",
          path: `${__dirname}/static/img/`
        }
      },
      {
        resolve: "gatsby-source-filesystem",
        options: {
          name: "posts",
          path: `${__dirname}/content`
        }
      },
      {
        resolve: `gatsby-plugin-typography`,
        options: {
          pathToConfigModule: `src/styles/typography`,
        },
      },
      {
        resolve: `gatsby-plugin-google-fonts`,
        options: {
          fonts: [
            'Lato', 'Roboto'
          ],
  		    display: 'block'
        },
      },
      {
        resolve: "gatsby-plugin-google-analytics",
        options: {
          trackingId: config.siteGATrackingID
        }
      },
      {
        resolve: "gatsby-plugin-nprogress",
        options: {
          color: "#d84315"
        }
      },
      {
        resolve: "gatsby-plugin-manifest",
        options: {
          name: config.siteTitle,
          short_name: config.siteTitleShort,
          description: config.siteDescription,
          start_url: "/",
          background_color: "#e0e0e0",
          theme_color: "#d84315",
          display: "standalone",
          icon: "static/img/site-logo.png",
          include_favicon: true,
        },
      },
      {
        resolve: "gatsby-plugin-offline",
        options: {
          // Don't cache-bust JS or CSS files, and anything in the static directory,
          // since these files have unique URLs and their contents will never change
          dontCacheBustUrlsMatching: /(\.js$|\.css$|static\/)/,
          runtimeCaching: [{
              // Use networkFirst
              urlPattern: /(\.js$|\.css$|static\/)/,
              handler: `networkFirst`,
            },
            {
              // Add runtime caching of various other page resources
              urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
              handler: `staleWhileRevalidate`,
            },
            {
              // Google Fonts CSS (doesn't end in .css so we need to specify it)
              urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
              handler: `staleWhileRevalidate`,
            },
          ],
        },
      },
      "gatsby-plugin-catch-links",
      "gatsby-plugin-twitter",
      {
        resolve: "gatsby-plugin-sitemap",
        options: {
          output: "/sitemap.xml",
          query: `
            {
              site {
                siteMetadata {
                  siteUrl
                }
              }
  
              allSitePage(
                filter: {
                  path: {
                    regex: "${regexExcludeRobots}"
                  }
                }
              ) {
                edges {
                  node {
                    path
                  }
                }
              }
          }`
        }
      },
      `gatsby-plugin-material-ui`,
      {
        resolve: "gatsby-plugin-netlify-cms",
        options: {
          modulePath: `${__dirname}/src/cms/cms.ts`,
          customizeWebpackConfig: (config, { stage, plugins }) => {
            config.resolve = {
              ...config.resolve,
              alias: {
                ...config.resolve.alias,
              //  "material-ui-plugin-cache-endpoint": path.join(cache.directory, `styles-provider-props.js`)
              }
            };
          }
        },
      },
      {
        resolve: 'gatsby-plugin-html-attributes',
        options: {
          lang: 'en'
        }
      }
    ],
    pathPrefix: "/img",
  }