Skip to content

Conversation

@bradlc
Copy link
Contributor

@bradlc bradlc commented Aug 8, 2023

Ref: markdoc/markdoc#416, markdoc/markdoc#418

This PR adds support for specifying the metadata and revalidate exports when using app router:

---
nextjs:
  metadata:
    title: Lorem ipsum
    description: Lorem ipsum dolor sit amet
  revalidate: 60
---

Closes markdoc/markdoc#418
Closes markdoc/markdoc#416

Copy link
Contributor

@mfix-stripe mfix-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bradlc I'd like to group all the Next.js specific items under a single key, as you suggested above. I was thinking the key could be called next.js or nextjs, just to disambiguate with the work "next".

What do you think?

@bradlc bradlc changed the title Add support for Next.js metadata export Add support for Next.js app router exports Aug 9, 2023
@bradlc
Copy link
Contributor Author

bradlc commented Aug 9, 2023

Makes sense! I've updated the PR to include all exports that I could find under a nextjs key.

Export names come from:

Let me know if you have any additional feedback! 🤙

Copy link
Contributor

@mfix-stripe mfix-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bradlc! Just a couple comments

src/loader.js Outdated
]
const nextjsExportsCode = nextjsExports
.map((name) => {
return `export const ${name} = frontmatter.nextjs?.${name};`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpaul-stripe WDYT about using the nextjs frontmatter key to allow users to specify Next.js specific features (like metadata and revalidate)

Alternative keys:

  • next.js
  • config / options (higher chance for collisions)

I think I like next.js best (personally)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think nextjs is good.

bradlc and others added 3 commits August 10, 2023 09:23
Co-authored-by: Mike Fix <62121649+mfix-stripe@users.noreply.github.com>
Co-authored-by: Mike Fix <62121649+mfix-stripe@users.noreply.github.com>
'revalidate',
]
const nextjsExportsCode = nextjsExports
.map((name) => `export const ${name} = frontmatter.nextjs?.${name};`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpaul-stripe WDYT about using the nextjs frontmatter key to allow users to specify Next.js specific features (like metadata and revalidate)

Alternative keys:

  • next.js
  • config / options (higher chance for collisions)

I think I like next.js best (personally)

@mfix-stripe mfix-stripe merged commit 42f67e3 into markdoc:main Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for background revalidate export when using Next.js app-router Add support for Next.js page metadata export

3 participants