const { SeriesToC } = require("./src/components/series-toc"); let CONSTS = require("./config/gatsby-config-consts"); if (!CONSTS) CONSTS = {}; module.exports = { siteMetadata: { title: `Unicorn Utterances`, description: `Learning programming from magically majestic words. A place to learn about all sorts of programming topics from entry-level concepts to advanced abstractions`, siteUrl: `https://unicorn-utterances.com/`, disqusShortname: "unicorn-utterances", repoPath: "unicorn-utterances/unicorn-utterances", relativeToPosts: "/content/blog", keywords: "programming,development,mobile,web,game,utterances,software engineering,javascript,angular,react,computer science" }, plugins: [ { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/content/blog`, name: `blog` } }, { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/src/assets`, name: `assets` } }, { resolve: `gatsby-source-filesystem`, options: { path: `${__dirname}/content/site`, name: `sitecontent` } }, `gatsby-transformer-json`, `gatsby-plugin-typescript`, { resolve: `gatsby-source-filesystem`, options: { path: `./content/data` } }, { resolve: `gatsby-plugin-prefetch-google-fonts`, options: { fonts: [ { family: `Archivo`, variants: [`400`, `700`], subsets: [`latin`] }, { family: "Oswald", variants: [`400`, `700`] } ] } }, { resolve: `gatsby-transformer-remark`, options: { plugins: [ { resolve: `gatsby-remark-images`, options: { maxWidth: 590, linkImagesToOriginal: false } }, { resolve: "gatsby-remark-video", options: { width: "100%", height: "auto", preload: "auto", muted: true, autoplay: true, controls: true, loop: true } }, { resolve: `gatsby-remark-images-medium-zoom`, options: { includedSelector: '[src$=".svg"]' } }, { resolve: `gatsby-remark-responsive-iframe`, options: { wrapperStyle: `margin-bottom: 1.0725rem` } }, { resolve: `gatsby-remark-autolink-headers`, options: { offsetY: `100`, icon: ``, maintainCase: true, removeAccents: true, enableCustomId: true } }, { resolve: `gatsby-remark-prismjs`, options: { aliases: { gradle: "groovy" //prismjs doesn't support gradle yet, so aliasing it to groovy provides at least some highlighting } } }, `gatsby-remark-copy-linked-files`, `gatsby-remark-external-links`, { resolve: "gatsby-remark-series", options: { render: { // The location where the toc should be rendered. placeholder: "top", template: SeriesToC }, resolvers: { slug: markdownNode => `/posts${markdownNode.fields.slug}`, date: markdownNode => markdownNode.frontmatter.published, draft: () => false } } } ] } }, `count-inline-code`, `remarked-autolink-headers-and-add-id`, `gatsby-transformer-sharp`, `gatsby-plugin-sharp`, { resolve: `gatsby-plugin-google-analytics`, options: { trackingId: CONSTS.googleAnalytics || "", head: false, respectDNT: true } }, { resolve: `gatsby-plugin-feed`, options: { query: ` { site { siteMetadata { title description siteUrl site_url: siteUrl } } } `, feeds: [ { serialize: ({ query: { site, allMarkdownRemark } }) => { const siteUrl = site.siteMetadata.siteUrl; return allMarkdownRemark.edges.map(edge => { const slug = edge.node.fields.slug; const { frontmatter } = edge.node; const nodeUrl = `${siteUrl}/posts${slug}`; return { description: frontmatter.description || edge.node.excerpt, date: frontmatter.published, title: frontmatter.title, url: nodeUrl, guid: nodeUrl, custom_elements: [ /** * We chose `dc:creator` in order to avoid having * to list contact information from our contributors, * as `dc:creator` * * FIXME: This does not have the functionality we'd expect * it only lists the last author's name * * @see https://github.com/dylang/node-rss/issues/92 */ { "dc:creator": frontmatter.authors.map( author => author.name ) }, { comments: `${nodeUrl}#disqus_thread` } ] }; }); }, query: ` { allMarkdownRemark( sort: { order: DESC, fields: [frontmatter___published] }, filter: {fileAbsolutePath: {regex: "/content/blog/"}} ) { edges { node { excerpt html fields { slug } frontmatter { title description published authors { name } } } } } } `, output: "/rss.xml", title: "Unicorn Utterances's RSS Feed" } ] } }, { resolve: `gatsby-plugin-manifest`, options: { name: `Unicorn Utterances`, short_name: `Unicorn Utterances`, start_url: `/`, background_color: `#ffffff`, theme_color: `#127db3`, display: `minimal-ui`, icon: `src/assets/unicorn_utterances_logo_512.png` } }, `gatsby-plugin-offline`, `gatsby-plugin-react-helmet`, { resolve: "gatsby-plugin-react-svg", options: { rule: { include: /(?:\/src\/assets\/icons\/|\\src\\assets\\icons\\).*\.svg$/ } } }, `gatsby-plugin-sass`, { resolve: `gatsby-plugin-lunr`, options: { languages: [ { name: "en", // A function for filtering nodes. () => true by default filterNodes: node => !!node.frontmatter && !!node.frontmatter.authors } ], // Fields to index. If store === true value will be stored in index file. // Attributes for custom indexing logic. See https://lunrjs.com/docs/lunr.Builder.html for details fields: [ { name: "title", store: true, attributes: { boost: 20 } }, { name: "excerpt" }, { name: "description" }, { name: "slug", store: true }, { name: "authors" }, { name: "tags" } ], // How to resolve each field's value for a supported node type resolvers: { // For any node of type MarkdownRemark, list how to resolve the fields' values MarkdownRemark: { title: node => node.frontmatter.title, excerpt: node => node.excerpt, description: node => node.frontmatter.description, slug: node => node.fields.slug, /** * FIXME: This does not work the way we'd want. We want the name * the author rather than the username, but the node is not * populated * * @see https://github.com/humanseelabs/gatsby-plugin-lunr/issues/24 */ authors: node => node.frontmatter.authors.join(", "), tags: node => node.frontmatter.tags } }, //custom index file name, default is search_index.json filename: "search_index.json", //custom options on fetch api call for search_ındex.json fetchOptions: { credentials: "same-origin" } } }, `gatsby-plugin-sitemap`, { resolve: "gatsby-plugin-robots-txt", options: { resolveEnv: () => process.env.GITHUB_REF, env: { "refs/heads/integration": { host: "https://beta.unicorn-utterances.com/sitemap.xml", sitemap: "https://beta.unicorn-utterances.com/sitemap.xml", policy: [ { userAgent: "*", disallow: ["/"] } ] }, "refs/heads/master": { host: "https://unicorn-utterances.com/sitemap.xml", sitemap: `https://unicorn-utterances.com/sitemap.xml`, policy: [ { userAgent: "*", allow: "/" } ] } } } } ], mapping: { "MarkdownRemark.frontmatter.authors": `UnicornsJson`, "MarkdownRemark.frontmatter.license": `LicensesJson`, "UnicornsJson.pronouns": `PronounsJson`, "UnicornsJson.roles": `RolesJson` } };