JoshuaKGoldberg / Goldblog

Archived repository that's since been moved to https://github.com/JoshuaKGoldberg/joshuakgoldberg-dot-com
https://joshuakgoldberg.com/blog
MIT License
10 stars 3 forks source link

Support mdx for reusable image component #327

Open JoshuaKGoldberg opened 2 years ago

JoshuaKGoldberg commented 2 years ago

I have to copy & paste image markup between posts. Might as well make this reusable.

JoshuaKGoldberg commented 2 years ago

I tried this today and ran into a bunch of issues. For now I'm going to keep hardcoding markdown. 🤷

One little snippet to save for later:


exports.createSchemaCustomization = ({ actions }) => {
    const { createTypes } = actions;
    const typeDefs = `
      type Mdx implements Node {
        frontmatter: Frontmatter
      }

      type Frontmatter {
        link: FrontmatterLink
      }

      type FrontmatterLink {
        url: String!
        title: String!
      }
    `;
    createTypes(typeDefs);
};