The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Get The Latest MDX File With A Given Tag In Gatsby

TODO: Pull subtitle into page object

This code:

code_start_default_section code_end_default_section

will find a file

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Get The Latest MDX File With A Given Tag In Gatsby

-- p

This code:

-- code/
-- javascript

import React from "react"
import { useStaticQuery, Link, graphql } from "gatsby"


export default function LatestWipForHomePage() {

    const data = useStaticQuery(
        graphql`query {
            allMdx (
                sort: {
                    fields: [frontmatter___date, frontmatter___title]
                    order: DESC
                }, 
                filter: {frontmatter: {tags: {eq: "WIP"}}}, 
                limit: 1
                ) {
                edges {
                    node {
                    id
                    frontmatter {
                        title
                        slug
                        date
                        snippet
                    }
                    }
                }
            }
        }`
    )


    return (
        <div>
            {data.allMdx.edges.map(({ node }) => (
                <div key={node.id}>
                    <h3>
                        <Link to={node.frontmatter.slug}>
                            {node.frontmatter.title}{" "}
                        </Link>
                    </h3>
                    <p>{node.frontmatter.snippet}</p>
                </div>
            ))}
        </div>
    )
}

-- /code

-- p

will find a file


-- categories
-- Miscellaneous

-- metadata
-- date: 2021-02-17 22:12:02
-- id: 20enxcv7
-- status: published
-- type: post
-- SCRUBBED_NEO: false
-- site: aws