diff --git a/gatsby-node.ts b/gatsby-node.ts new file mode 100644 index 000000000..3a6ff5421 --- /dev/null +++ b/gatsby-node.ts @@ -0,0 +1,61 @@ +import type { Actions, CreatePagesArgs, GatsbyNode } from "gatsby"; +import path from "path"; + +interface IMakePages { + createPage: Actions["createPage"] + graphql: CreatePagesArgs["graphql"] +} + +export const createPages: GatsbyNode["createPages"] = async ({ actions: { createPage }, graphql }) => { + + const utils: IMakePages = {createPage, graphql}; + + await makeCollectionPages(utils) +} + +async function makeCollectionPages({createPage, graphql}: IMakePages) { + const results = await graphql(` + query qCollections { + allAirtableScdItems( + filter: {data: {scd_publish_status: {nin: ["duplicate-record-do-not-display", "do-not-display"]}}} + ) { + nodes { + data { + _xxxid + scd_publish_status + _xxxcollectionOwnerNamextxt + _xxxcollectionTitlextxt + _xxxcollectionDescriptionxtxt + _xxxcollectionExtentxtxt + _xcollectionFormatsxtxtxxxcollectionFormatsxtxt + _xxxcollectionContentTypesxtxtxxxcollectionContentTypesxtxt + _xxxcollectionGenresxtxtxxxcollectionGenresxtxt + _xxxcollectionFindingAidUrlxtxt + _xxxcollectionOwnerLocationCountryxtxt + _xxxcollectionOwnerLocationStatextxt + _xxxcollectionCatalogUrlxtxt + _xxxcollectionInventoryDescriptionxtxtxxxcollectionInventoryDescriptionxtxt + _xxxcollectionLanguagesxtxtxxxcollectionLanguagesxtxt + _xxxcollectionNotesxtxt + _xxxcollectionOwnerLocationCityxtxt + _xxxcollectionUsageStatementxtxt + _xxxcollectionWebsiteUrlxtxt + } + } + } + } + `) + + const {nodes} = (results.data as Queries.qCollectionsQuery).allAirtableScdItems; + + for (const node of nodes) { + const collection = node.data + createPage({ + path: `/collections/${collection?._xxxid}/`, + component: path.resolve(`./src/templates/collection.tsx`), + context: { + ...collection + } + }) + } +} diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 3532e7095..4f4c88c55 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -5,7 +5,7 @@ import logoArsc from "../images/arsc-logo.png" import logoMith from "../images/MITHgrayscale.png" const Footer = () => { - return (