Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778export const createPostBreadcrumbs = ({ name, canonicalUrl,}: { name: string; canonicalUrl: string;}) => { return { "@context": "https://schema.org", "@type": "BreadcrumbList", itemListElement: [ { "@type": "ListItem", position: 1, name: "Blog posts", item: "https://johnwhiles.com/posts", }, { "@type": "ListItem", position: 2, name: name, item: canonicalUrl, }, ], };};
export const createSeoPageMetaTags = ({ ogTitle, description, ogType, canonicalUrl,}: { /* * A title for the page, that should be rendered on social media shares. Make this short and snappy * and appealing to people, not to robots. */ ogTitle: string; /* * A description for the page, that should be rendered on social media shares. * Will be plain text, and won't be rendered nicely by the site. So don't shove it full of links. */ description?: string; /* * The type of the page. Different page types will be shared differently. */ ogType: "website" | "article";
/* * The URL to which SEO should be attributed. Strip out any query parameters, and make sure it's something that will _never change_ */ canonicalUrl: string;}) => { const tags = [ { property: "og:title", content: ogTitle, }, { property: "og:type", content: ogType, }, { tagName: "link", rel: "canonical", href: canonicalUrl, }, ];
if (description) { tags.push({ property: "og:description", content: description, }); } return tags;};