rename archive to spotlights

This commit is contained in:
Mark
2021-10-24 16:35:05 +01:00
parent 3aa18ba885
commit 4d000252ec
31 changed files with 25 additions and 25 deletions
+2 -2
View File
@@ -68,8 +68,8 @@ module.exports = {
{ {
resolve: `gatsby-source-filesystem`, resolve: `gatsby-source-filesystem`,
options: { options: {
name: `what-is-archive`, name: `spotlights`,
path: `${__dirname}/src/content/archives`, path: `${__dirname}/src/content/spotlights`,
}, },
}, },
`gatsby-transformer-sharp`, `gatsby-transformer-sharp`,
+7 -7
View File
@@ -7,7 +7,7 @@ const fs = require("fs")
const requiredArticleFrontmatter = ["authors", "date"] const requiredArticleFrontmatter = ["authors", "date"]
const LAYOUT_RESOURCES = "resources" const LAYOUT_RESOURCES = "resources"
const LAYOUT_ARCHIVES = "archives" const LAYOUT_ARCHIVES = "spotlights"
const LAYOUT_REGULAR = "regular" const LAYOUT_REGULAR = "regular"
const LAYOUT_HOME = "home" const LAYOUT_HOME = "home"
@@ -20,7 +20,7 @@ function resolveLayout(path) {
return LAYOUT_RESOURCES return LAYOUT_RESOURCES
} }
if (path.match(/archives/)) { if (path.match(/spotlights/)) {
return LAYOUT_ARCHIVES return LAYOUT_ARCHIVES
} }
@@ -133,7 +133,7 @@ const createArchives = async ({ createPage, graphql }) => {
const result = await graphql(` const result = await graphql(`
query FetchArchives { query FetchArchives {
allFile(filter: { sourceInstanceName: { eq: "what-is-archive" } }) { allFile(filter: { sourceInstanceName: { eq: "spotlights" } }) {
edges { edges {
node { node {
relativePath relativePath
@@ -150,7 +150,7 @@ const createArchives = async ({ createPage, graphql }) => {
return result.data.allFile.edges.forEach(({ node }) => { return result.data.allFile.edges.forEach(({ node }) => {
createPage({ createPage({
path: path.posix.join("archives", node.relativePath), path: path.posix.join("spotlights", node.relativePath),
component: archive, component: archive,
context: { context: {
file: node.relativePath, file: node.relativePath,
@@ -163,7 +163,7 @@ const createArchives = async ({ createPage, graphql }) => {
exports.onCreateNode = async ({ node, getNode, actions }) => { exports.onCreateNode = async ({ node, getNode, actions }) => {
const { createPage, createNodeField } = actions const { createPage, createNodeField } = actions
// TODO: find a better way to avoid handling non-resources // TODO: find a better way to avoid handling non-resources
// or better, attach authors to what-is archives // or better, attach authors to spotlights
if (node.internal.type === "Mdx" && node.frontmatter.authors) { if (node.internal.type === "Mdx" && node.frontmatter.authors) {
const { frontmatter } = node const { frontmatter } = node
const isDoc = Boolean(!frontmatter.path) const isDoc = Boolean(!frontmatter.path)
@@ -197,9 +197,9 @@ exports.onCreatePage = async ({ page, actions }) => {
const oldPage = { ...page } const oldPage = { ...page }
page.matchPath = `/resources/*` page.matchPath = `/resources/*`
deletePage(oldPage) deletePage(oldPage)
} else if (page.path.match(/^\/archives\/404/)) { } else if (page.path.match(/^\/spotlights\/404/)) {
const oldPage = { ...page } const oldPage = { ...page }
page.matchPath = `/archives/*` page.matchPath = `/spotlights/*`
deletePage(oldPage) deletePage(oldPage)
} }
+2 -2
View File
@@ -12,7 +12,7 @@ import * as SC from "./styles"
const ALL_ARCHIVES = graphql` const ALL_ARCHIVES = graphql`
query { query {
archives: allFile( archives: allFile(
filter: { sourceInstanceName: { eq: "what-is-archive" } } filter: { sourceInstanceName: { eq: "spotlights" } }
) { ) {
edges { edges {
node { node {
@@ -44,7 +44,7 @@ function Tree({ item }: { item: IFileOrFolder }) {
export const ArchivesSidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => { export const ArchivesSidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
const { archives } = useStaticQuery(ALL_ARCHIVES) const { archives } = useStaticQuery(ALL_ARCHIVES)
const tree = useBuildTree(archives, "/archives") const tree = useBuildTree(archives, "/spotlights")
const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree) const sortedTree = sort((a, b) => a.title.localeCompare(b.title), tree)
return ( return (
+1 -1
View File
@@ -78,7 +78,7 @@ export const Home: FC = () => {
<MenuItem to="/faq">faq</MenuItem> <MenuItem to="/faq">faq</MenuItem>
<MenuItem to="/bots">bots</MenuItem> <MenuItem to="/bots">bots</MenuItem>
<MenuItem to="/resources">resources</MenuItem> <MenuItem to="/resources">resources</MenuItem>
<MenuItem to="/archives">tech spotlights</MenuItem> <MenuItem to="/spotlights">tech spotlights</MenuItem>
</SC.Menu> </SC.Menu>
<DiscordButton>join us</DiscordButton> <DiscordButton>join us</DiscordButton>
<HomePartner /> <HomePartner />
+1 -1
View File
@@ -44,7 +44,7 @@ export const Sidebar: FC<HTMLAttributes<HTMLDivElement>> = (props) => {
<MenuItem to="/faq">faq</MenuItem> <MenuItem to="/faq">faq</MenuItem>
<MenuItem to="/bots">bots</MenuItem> <MenuItem to="/bots">bots</MenuItem>
<MenuItem to="/resources">resources</MenuItem> <MenuItem to="/resources">resources</MenuItem>
<MenuItem to="/archives">tech spotlights</MenuItem> <MenuItem to="/spotlights">tech spotlights</MenuItem>
</SC.Menu> </SC.Menu>
<ThemeToggler /> <ThemeToggler />
+1 -1
View File
@@ -6,7 +6,7 @@ import { ColumnLayout } from "../ColumnLayout"
export const ArchivesLayout: FC = ({ children }) => { export const ArchivesLayout: FC = ({ children }) => {
return ( return (
<ColumnLayout <ColumnLayout
title="Archives" title="Spotlights"
sidebar={ArchivesSidebar} sidebar={ArchivesSidebar}
content={children} content={children}
/> />
+1 -1
View File
@@ -21,7 +21,7 @@ const BaseLayout: FC<IBaseLayout> = (props) => {
switch (props.pageContext.layout) { switch (props.pageContext.layout) {
case "resources": case "resources":
return ResourcesLayout return ResourcesLayout
case "archives": case "spotlights":
return ArchivesLayout return ArchivesLayout
case "regular": case "regular":
return PageLayout return PageLayout
+4 -4
View File
@@ -14,12 +14,12 @@ const FourZeroFourPage: React.FC<{ data: { allFile: FileConnection } }> = ({
data, data,
}: ComponentQuery<{ allFile: FileConnection }>) => ( }: ComponentQuery<{ allFile: FileConnection }>) => (
<Fragment> <Fragment>
<SEO title="404: Archive Not found" /> <SEO title="404: Spotlight Not found" />
<FourZeroFour title="ARCHIVE NOT FOUND"> <FourZeroFour title="SPOTLIGHT NOT FOUND">
<Location> <Location>
{({ location }) => ( {({ location }) => (
<FourZeroFourHint <FourZeroFourHint
basepath="archives/" basepath="spotlights/"
location={location} location={location}
data={data} data={data}
/> />
@@ -33,7 +33,7 @@ export default FourZeroFourPage
export const query = graphql` export const query = graphql`
query { query {
allFile(filter: { sourceInstanceName: { eq: "what-is-archive" } }) { allFile(filter: { sourceInstanceName: { eq: "spotlights" } }) {
edges { edges {
node { node {
relativePath relativePath
+5 -5
View File
@@ -8,15 +8,15 @@ import { SEO } from "../../components/SEO"
function ArchivesPage() { function ArchivesPage() {
return ( return (
<Fragment> <Fragment>
<SEO title="Tech Spotlights Archives" /> <SEO title="Tech Spotlights" />
<HeaderBarebone title="Welcome to the TPH tech spotlights archives." /> <HeaderBarebone title="Welcome to the TPH tech spotlights." />
<PageContent <PageContent
content={ content={
<p> <p>
This regroups the archives of our occasional, temporary channels This is a collection of our technology spotlights that have been
that cover a piece of technology that might be unknown to part of highlighted in our discord server. Spotlights run for one month
our users. You can find those on{" "} within the server before appearing here. You can find those on{" "}
<Link to="/about">The Programmer&apos;s Hangout</Link>. <Link to="/about">The Programmer&apos;s Hangout</Link>.
</p> </p>
} }
+1 -1
View File
@@ -18,7 +18,7 @@ const Archive: FC<any> = ({ data }) => {
<SEO title={title} description={excerpt} /> <SEO title={title} description={excerpt} />
<Header <Header
relativePath={relativePath} relativePath={relativePath}
basePath="/archives" basePath="/spotlights"
title={title} title={title}
authors={fields.authors} authors={fields.authors}
createdAt={frontmatter.created_at} createdAt={frontmatter.created_at}