Trekiros
Trekiros
TTCTheo's Typesafe Cult
Created by Trekiros on 1/29/2024 in #questions
Setting the open graph title on a dynamic route within the nextjs pages router
Managed to fix it Somehow this is the first time in 2 years with nextjs I've ever needed to use getStaticProps/getStaticPaths 😐
export const getStaticProps: GetStaticProps<{id: string}> = async (context) => {
const id = context.params?.id as string
return { props: { id } }
}

export const getStaticPaths: GetStaticPaths<{id: string}> = async () => {
return {
paths: Object.keys(Rules).map(id => ({ params: { id } })),
fallback: true,
}
}

const RulePage = ({ id }) => {
const rule = Rules[id]
...
export const getStaticProps: GetStaticProps<{id: string}> = async (context) => {
const id = context.params?.id as string
return { props: { id } }
}

export const getStaticPaths: GetStaticPaths<{id: string}> = async () => {
return {
paths: Object.keys(Rules).map(id => ({ params: { id } })),
fallback: true,
}
}

const RulePage = ({ id }) => {
const rule = Rules[id]
...
5 replies
TTCTheo's Typesafe Cult
Created by Trekiros on 1/29/2024 in #questions
Setting the open graph title on a dynamic route within the nextjs pages router
No description
5 replies