From 15105246ea4e5722a42b29720a412d7ef3652031 Mon Sep 17 00:00:00 2001 From: Piotr Monwid-Olechnowicz Date: Wed, 18 Dec 2024 06:20:05 +0100 Subject: [PATCH] Export sharedMetaItems for meta.ts files (#1891) Co-authored-by: Dimitri POSTOLOV --- .changeset/fair-pumas-trade.md | 5 +++ packages/components/src/server/index.ts | 1 + .../src/server/shared-meta-items.ts | 45 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .changeset/fair-pumas-trade.md create mode 100644 packages/components/src/server/shared-meta-items.ts diff --git a/.changeset/fair-pumas-trade.md b/.changeset/fair-pumas-trade.md new file mode 100644 index 000000000..db9f35fec --- /dev/null +++ b/.changeset/fair-pumas-trade.md @@ -0,0 +1,5 @@ +--- +"@theguild/components": patch +--- + +Export sharedMetaItems for meta.ts files diff --git a/packages/components/src/server/index.ts b/packages/components/src/server/index.ts index b6fc7ed98..ea186a635 100644 --- a/packages/components/src/server/index.ts +++ b/packages/components/src/server/index.ts @@ -7,6 +7,7 @@ export { fetchFilePathsFromGitHub } from 'nextra/fetch-filepaths-from-github'; export { compileMdx } from 'nextra/compile'; export { getPageMap, createIndexPage } from 'nextra/page-map'; export { fetchPackageInfo } from './npm.js'; +export { sharedMetaItems } from './shared-meta-items'; /** * Contain `getPageMap` import which imports `metadata` from pages, in case importing from diff --git a/packages/components/src/server/shared-meta-items.ts b/packages/components/src/server/shared-meta-items.ts new file mode 100644 index 000000000..7d163c758 --- /dev/null +++ b/packages/components/src/server/shared-meta-items.ts @@ -0,0 +1,45 @@ +import { PRODUCTS_MENU_LIST, ProductType } from '../products'; + +export function sharedMetaItems(options: { githubUrl: string; product: ProductType }) { + return { + products: { + title: 'Products', + type: 'menu', + items: PRODUCTS_MENU_LIST, + }, + ecosystem: { + title: 'Ecosystem', + type: 'page', + ...(options.product !== 'HIVE' && { href: 'https://the-guild.dev/graphql/hive/ecosystem' }), + }, + blog: { + title: 'Blog', + type: 'page', + href: 'https://the-guild.dev/blog', + }, + github: { + title: 'GitHub', + type: 'page', + href: options.githubUrl, + }, + 'the-guild': { + title: 'The Guild', + type: 'menu', + items: { + 'about-us': { + title: 'About Us', + href: 'https://the-guild.dev/about-us', + }, + 'brand-assets': { + title: 'Brand Assets', + href: 'https://the-guild.dev/logos', + }, + }, + }, + 'graphql-foundation': { + title: 'GraphQL Foundation', + type: 'page', + href: 'https://graphql.org/community/foundation', + }, + }; +}