import React from "react"; import { DocsThemeConfig, useConfig } from "nextra-theme-docs"; // import { Footer } from "./components/footer"; import { Matrix } from "./components/matrix-link"; import { Explorer } from "./components/explorer-link"; import { useRouter } from "next/router"; const config: DocsThemeConfig = { head: function useHead() { const config = useConfig(); const { route } = useRouter(); const url = process.env.NEXT_PUBLIC_SITE_URL; const image = url + "/images/Nym_meta_Image.png"; const favicon = url + "/favicon.svg"; const defaultDescription = "Nym is a privacy platform. It provides strong network-level privacy against sophisticated end-to-end attackers, and anonymous access control using blinded, re-randomizable, decentralized credentials."; // Frontmatter-first description const description = config.frontMatter.description || defaultDescription; const baseTitle = config.frontMatter.title || config.title || ""; const title = route === "/" ? "Nym Docs: Privacy Network Documentation" : baseTitle.includes("| Nym Docs") ? baseTitle : `${baseTitle} | Nym Docs`; const pageUrl = `${url}${route}`; // Frontmatter fields const section = config.frontMatter.section || ""; const lastUpdated = config.frontMatter.lastUpdated || ""; const schemaType = config.frontMatter.schemaType || "TechArticle"; // JSON-LD structured data const org = { "@id": "https://nym.com/#org", "@type": "Organization", name: "Nym Technologies SA", url: "https://nym.com", logo: { "@id": "https://nym.com/#logo", "@type": "ImageObject", url: "https://nym.com/apple-touch-icon.png", }, sameAs: ["https://x.com/nymproject", "https://github.com/nymtech"], }; const website = { "@id": "https://nym.com/docs#website", "@type": "WebSite", name: "Nym Docs", url: "https://nym.com/docs", publisher: { "@id": "https://nym.com/#org" }, }; const webpage = { "@id": `${pageUrl}#webpage`, "@type": "WebPage", url: pageUrl, name: title, description: description, inLanguage: "en", isPartOf: { "@id": "https://nym.com/docs#website" }, breadcrumb: { "@id": `${pageUrl}#breadcrumb` }, potentialAction: { "@type": "ReadAction", target: pageUrl }, }; const articleSchema: Record = { "@id": `${pageUrl}#article`, "@type": schemaType, ...(schemaType === "HowTo" ? { name: baseTitle } : { headline: baseTitle }), description: description, url: pageUrl, author: { "@id": "https://nym.com/#org" }, publisher: { "@id": "https://nym.com/#org" }, mainEntityOfPage: { "@id": `${pageUrl}#webpage` }, ...(lastUpdated && { datePublished: lastUpdated, dateModified: lastUpdated, }), }; const pathParts = route.split("/").filter(Boolean); const breadcrumb = { "@id": `${pageUrl}#breadcrumb`, "@type": "BreadcrumbList", itemListElement: pathParts.map((part: string, i: number) => ({ "@type": "ListItem", position: i + 1, name: config.frontMatter.breadcrumbLabel && i === pathParts.length - 1 ? config.frontMatter.breadcrumbLabel : part.charAt(0).toUpperCase() + part.slice(1).replace(/-/g, " "), item: `${url}/${pathParts.slice(0, i + 1).join("/")}`, })), }; const schema = { "@context": "https://schema.org", "@graph": [org, website, webpage, articleSchema, breadcrumb], }; return ( <> {title} {section && } {lastUpdated && ( )}