diff --git a/website/docs/contribution/cli/templates.mdx b/website/docs/contribution/cli/templates.mdx index 38867f18..987e2d4f 100644 --- a/website/docs/contribution/cli/templates.mdx +++ b/website/docs/contribution/cli/templates.mdx @@ -1,6 +1,7 @@ --- sidebar_position: 3 -title: New Project Templates +title: "CLI Project Templates" +sidebar_label: "Templates" description: How to add new project templates to the Compose CLI and keep the template registry in sync. --- diff --git a/website/docs/contribution/code-style-guide.mdx b/website/docs/contribution/code-style-guide.mdx index 1ca41b69..b98322a8 100644 --- a/website/docs/contribution/code-style-guide.mdx +++ b/website/docs/contribution/code-style-guide.mdx @@ -1,9 +1,12 @@ --- sidebar_position: 3 -title: Code Style Guide +title: "Code Style Guide — Solidity Conventions" +sidebar_label: "Code Style" description: Code style guidelines for developing Compose facets and modules --- +# Code Style Guide + This section outlines the code style guidelines for developing new facets and Solidity modules in **Compose**. Follow [Compose's design principles](/docs/design) when contributing code. diff --git a/website/docs/contribution/documentation/all-components.mdx b/website/docs/contribution/documentation/all-components.mdx index f4f21864..dd9235f8 100644 --- a/website/docs/contribution/documentation/all-components.mdx +++ b/website/docs/contribution/documentation/all-components.mdx @@ -1,6 +1,7 @@ --- sidebar_position: 2 title: All Components - Complete Reference +sidebar_label: "All Components" description: Complete reference of all documentation UI components—Badge, Callout, Accordion, APIReference, and more—with usage examples for Compose docs. draft: true --- diff --git a/website/docs/contribution/documentation/system-design-guide.mdx b/website/docs/contribution/documentation/system-design-guide.mdx index 4d3241e2..10cc6e73 100644 --- a/website/docs/contribution/documentation/system-design-guide.mdx +++ b/website/docs/contribution/documentation/system-design-guide.mdx @@ -1,6 +1,7 @@ --- sidebar_position: 1 title: Documentation Design Guide +sidebar_label: "Design Guide" description: Comprehensive guide for creating consistent, high-quality documentation draft: true --- diff --git a/website/docs/contribution/how-to-contribute.mdx b/website/docs/contribution/how-to-contribute.mdx index 1f1c576a..f7b15a93 100644 --- a/website/docs/contribution/how-to-contribute.mdx +++ b/website/docs/contribution/how-to-contribute.mdx @@ -1,9 +1,12 @@ --- sidebar_position: 1 -title: How to Contribute +title: "How to Contribute to Compose" +sidebar_label: "How to Contribute" description: Learn how to contribute to Compose --- +# How to Contribute + Thank you for your interest in contributing to Compose! Compose is a community developed project. We welcome you and want your help. diff --git a/website/docs/contribution/testing.mdx b/website/docs/contribution/testing.mdx index 485c89be..6ba08ccb 100644 --- a/website/docs/contribution/testing.mdx +++ b/website/docs/contribution/testing.mdx @@ -1,9 +1,12 @@ --- sidebar_position: 4 -title: Testing +title: "Testing — Behavior-First with Foundry" +sidebar_label: "Testing" description: Compose tests are **behavior-first** and primarily written with Foundry fuzz tests. --- +# Testing + Compose tests are **behavior-first** and primarily written with Foundry fuzz tests. ## Testing Philosophy diff --git a/website/docs/design/banned-solidity-features.mdx b/website/docs/design/banned-solidity-features.mdx index d48a1a5c..9d661326 100644 --- a/website/docs/design/banned-solidity-features.mdx +++ b/website/docs/design/banned-solidity-features.mdx @@ -1,11 +1,14 @@ --- sidebar_position: 4 -title: Banned Solidity Features +title: "Banned Solidity Features" +sidebar_label: "Banned Features" description: Solidity language features that are banned from Compose facets and modules. --- import Callout from '@site/src/components/ui/Callout'; +# Banned Solidity Features + The following Solidity language features are **banned** from Compose facets and modules. Compose restricts certain Solidity features to keep facet and library code **simpler**, **more consistent**, and **easier to reason about**. diff --git a/website/docs/design/design-for-composition.mdx b/website/docs/design/design-for-composition.mdx index 03ec0e48..ed89c2fa 100644 --- a/website/docs/design/design-for-composition.mdx +++ b/website/docs/design/design-for-composition.mdx @@ -1,12 +1,15 @@ --- -sidebar_position: 5 -title: Design for Composition +sidebar_position: 3 +title: "Design for Composition — Guidelines & Rules" +sidebar_label: "Composition" description: How to design Compose facets and modules for composition. --- import Callout from '@site/src/components/ui/Callout'; import ExpandableCode from '@site/src/components/code/ExpandableCode'; +# Design for Composition + Here are the guidelines and rules for creating composable facets. Compose replaces source-code inheritance with on-chain composition. Facets are the building blocks; diamonds wire them together. diff --git a/website/docs/design/index.mdx b/website/docs/design/index.mdx index 4cd415a7..dc528d69 100644 --- a/website/docs/design/index.mdx +++ b/website/docs/design/index.mdx @@ -1,6 +1,7 @@ --- sidebar_position: 1 -title: Compose Design +title: "Design Principles" +sidebar_label: "Overview" description: Overview for how Compose is designed sidebar_class_name: hidden --- diff --git a/website/docs/design/maintain-compatibility.mdx b/website/docs/design/maintain-compatibility.mdx index 445b67ed..be3a4b14 100644 --- a/website/docs/design/maintain-compatibility.mdx +++ b/website/docs/design/maintain-compatibility.mdx @@ -1,9 +1,12 @@ --- -sidebar_position: 6 -title: Maintain Compatibility +sidebar_position: 5 +title: "Maintain Compatibility — Standards & Interoperability" +sidebar_label: "Compatibility" description: Maintain compatibility with existing standards, libraries, and systems --- +# Maintain Compatibility + Build for interoperability. Before implementing a facet or feature, identify existing standards and expected behaviors, and ensure your implementation behaves the same where it matters. Code style can differ; externally observable behavior should not. Implementation checklist: diff --git a/website/docs/design/repeat-yourself.mdx b/website/docs/design/repeat-yourself.mdx index b7ab7676..bd0de2aa 100644 --- a/website/docs/design/repeat-yourself.mdx +++ b/website/docs/design/repeat-yourself.mdx @@ -1,11 +1,13 @@ --- -sidebar_position: 3 -title: Repeat Yourself +sidebar_position: 2 +title: "Repeat Yourself — Intentional Code Duplication" +sidebar_label: "Repeat Yourself" description: Repeat yourself when it makes your code easier to read and understand. --- import Callout from '@site/src/components/ui/Callout'; +# Repeat Yourself The DRY principle — *Don't Repeat Yourself* — is a well-known rule in software development. We **intentionally** break that rule. diff --git a/website/docs/design/written-to-be-read.mdx b/website/docs/design/written-to-be-read.mdx index d6c2b759..eebab6e3 100644 --- a/website/docs/design/written-to-be-read.mdx +++ b/website/docs/design/written-to-be-read.mdx @@ -1,9 +1,11 @@ --- -sidebar_position: 2 -title: Compose Is Written to Be Read +sidebar_position: 1 +title: "Written to Be Read — Code Readability First" +sidebar_label: "Readability" description: Compose is written to be read by other developers. --- +# Written to Be Read The primary design principle of Compose is **the code should be easy to read and understand**. diff --git a/website/docs/foundations/composable-facets.mdx b/website/docs/foundations/composable-facets.mdx index 823693e6..46c5a2eb 100644 --- a/website/docs/foundations/composable-facets.mdx +++ b/website/docs/foundations/composable-facets.mdx @@ -1,11 +1,14 @@ --- -sidebar_position: 6 -title: Composable Facets +sidebar_position: 5 +title: "Composable Facets — Modular Building Blocks" +sidebar_label: "Composable Facets" description: Mix and match facets to build complex systems from simple, interoperable building blocks. --- import Callout from '@site/src/components/ui/Callout'; +# Composable Facets + The word **"composable"** means *able to be combined with other parts to form a whole*. In **Compose**, facets are designed to be **composable**. They're built to interoperate seamlessly with other facets inside the same diamond. diff --git a/website/docs/foundations/custom-facets.mdx b/website/docs/foundations/custom-facets.mdx index 42421c31..eb4b6b36 100644 --- a/website/docs/foundations/custom-facets.mdx +++ b/website/docs/foundations/custom-facets.mdx @@ -1,11 +1,14 @@ --- -sidebar_position: 8 -title: "Custom Functionality: Compose Your Own Facets" +sidebar_position: 7 +title: "Custom Facets — Build Your Own" +sidebar_label: "Custom Facets" description: "Build your own facets that work seamlessly with existing Compose Functionality." --- import Callout from '@site/src/components/ui/Callout'; +# Custom Facets + Many projects need custom functionality beyond the standard facets. Compose is designed for this — you can build and integrate your own facets that work seamlessly alongside existing Compose facets. diff --git a/website/docs/foundations/diamond-contracts.mdx b/website/docs/foundations/diamond-contracts.mdx index fa112367..b9645bdd 100644 --- a/website/docs/foundations/diamond-contracts.mdx +++ b/website/docs/foundations/diamond-contracts.mdx @@ -1,12 +1,15 @@ --- -sidebar_position: 2 -title: Diamond Contracts +sidebar_position: 1 +title: "Diamond Contracts — Facets, Storage & Delegation" +sidebar_label: "Diamond Contracts" description: "Understand Diamonds from the ground up—facets, storage, delegation, and how Compose uses them." --- import SvgThemeRenderer from '@site/src/components/theme/SvgThemeRenderer'; import Callout from '@site/src/components/ui/Callout'; +# Diamond Contracts + A **diamond contract** is a smart contract that is made up of multiple parts instead of one large block of code. The diamond exists at **one address** and holds **all of the contract's storage**, but it uses separate smart contracts called **facets** to provide its functionality. Users interact only with the **diamond**, but the diamond's features come from its **facets**. Each facet provides a small, focused set of functions, and the diamond uses those functions to perform its actions. diff --git a/website/docs/foundations/facets-and-modules.mdx b/website/docs/foundations/facets-and-modules.mdx index c0b35f11..ab6b6525 100644 --- a/website/docs/foundations/facets-and-modules.mdx +++ b/website/docs/foundations/facets-and-modules.mdx @@ -1,9 +1,12 @@ --- -sidebar_position: 7 -title: "Understanding Facets and Modules" +sidebar_position: 6 +title: "Facets and Modules — How They Work Together" +sidebar_label: "Facets & Modules" description: Learn how facets and modules work together through shared storage to build composable systems. --- +# Facets and Modules + Compose uses two complementary patterns for smart contract development: ### Facets (Complete Implementations) diff --git a/website/docs/foundations/index.mdx b/website/docs/foundations/index.mdx index 45a8b489..ba135285 100644 --- a/website/docs/foundations/index.mdx +++ b/website/docs/foundations/index.mdx @@ -1,5 +1,6 @@ --- -title: Foundations +title: "Foundations — Core Concepts" +sidebar_label: "Overview" description: Compose smart contracts are designed to be composable. sidebar_class_name: hidden --- @@ -10,6 +11,8 @@ import Icon from '@site/src/components/ui/Icon'; import CalloutBox from '@site/src/components/ui/CalloutBox'; import Callout from '@site/src/components/ui/Callout'; +# Foundations: Core Concepts of Compose + Compose is a new approach to smart contract development that changes how developers build and deploy smart contract systems. This section introduces the core concepts that make Compose unique. diff --git a/website/docs/foundations/onchain-contract-library.mdx b/website/docs/foundations/onchain-contract-library.mdx index 53a6a971..c0e82682 100644 --- a/website/docs/foundations/onchain-contract-library.mdx +++ b/website/docs/foundations/onchain-contract-library.mdx @@ -1,12 +1,15 @@ --- -sidebar_position: 4 -title: On-chain Library +sidebar_position: 3 +title: "On-chain Contract Library" +sidebar_label: "On-chain Library" description: Compose provides a set of reusable on-chain contracts that already exist on blockchains --- import DocSubtitle from '@site/src/components/docs/DocSubtitle'; import Callout from '@site/src/components/ui/Callout'; +# On-chain Contract Library + **Compose takes a different approach.** diff --git a/website/docs/foundations/reusable-facet-logic.mdx b/website/docs/foundations/reusable-facet-logic.mdx index fc511550..425ba2fc 100644 --- a/website/docs/foundations/reusable-facet-logic.mdx +++ b/website/docs/foundations/reusable-facet-logic.mdx @@ -1,12 +1,15 @@ --- -sidebar_position: 5 -title: Reusable Logic +sidebar_position: 4 +title: "Reusable Facet Logic — Deploy Once, Reuse Everywhere" +sidebar_label: "Reusable Logic" description: Deploy once, reuse everywhere. Compose facets are shared across thousands of projects. --- import DiamondFacetsSVG from '@site/static/img/svg/compose_diamond_facets.svg' import Callout from '@site/src/components/ui/Callout'; +# Reusable Facet Logic + You might be wondering: **How can I create a new project without deploying new smart contracts?** The answer lies in Compose's smart contract architecture, which is based on [diamond contracts](/docs/foundations/diamond-contracts). diff --git a/website/docs/foundations/solidity-modules.mdx b/website/docs/foundations/solidity-modules.mdx index 4a6a18d4..4182f29b 100644 --- a/website/docs/foundations/solidity-modules.mdx +++ b/website/docs/foundations/solidity-modules.mdx @@ -1,11 +1,13 @@ --- -sidebar_position: 3 -title: Solidity Modules +sidebar_position: 2 +title: "Solidity Modules — Reusable Logic Outside Contracts" +sidebar_label: "Solidity Modules" description: What Solidity modules are, how they differ from contracts and libraries, and how Compose uses them for reusable facet logic and shared storage. --- import ExpandableCode from '@site/src/components/code/ExpandableCode'; +# Solidity Modules Solidity **modules** are Solidity files whose top-level code lives *outside* of contracts and Solidity libraries. They contain reusable logic that gets pulled into other contracts at compile time. diff --git a/website/docs/getting-started/installation.md b/website/docs/getting-started/installation.md index 526b0c1f..c52f672b 100644 --- a/website/docs/getting-started/installation.md +++ b/website/docs/getting-started/installation.md @@ -1,5 +1,8 @@ --- sidebar_position: 1 +title: "Installation" +sidebar_label: "Installation" +description: "Get up and running with Compose in just a few minutes." --- import DocSubtitle from '@site/src/components/docs/DocSubtitle'; diff --git a/website/docs/intro.mdx b/website/docs/intro.mdx index 8b9deec5..c7d42e25 100644 --- a/website/docs/intro.mdx +++ b/website/docs/intro.mdx @@ -1,7 +1,8 @@ --- sidebar_position: 1 slug: / -title: "Introduction" +title: "Smart Contract Library for ERC-2535 / ERC-8153 Diamonds" +sidebar_label: "Introduction" description: Compose is a smart contract library for building smart contract systems using the ERC-2535 Diamond standard. --- @@ -10,6 +11,7 @@ import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; import Callout from '@site/src/components/ui/Callout'; import FeatureGrid, { FeatureGridItem } from '@site/src/components/features/FeatureGrid'; +# Introduction to Compose **Compose** is a smart contract library that helps developers build smart contract systems using the [ERC-2535 Diamond](https://eips.ethereum.org/EIPS/eip-2535) standard. It's designed from the ground up for **code clarity**, **reusability**, and **on-chain composability**. diff --git a/website/docs/library/access/Owner/TwoSteps/index.mdx b/website/docs/library/access/Owner/TwoSteps/index.mdx index 78745ef6..cf6e3aaf 100644 --- a/website/docs/library/access/Owner/TwoSteps/index.mdx +++ b/website/docs/library/access/Owner/TwoSteps/index.mdx @@ -1,5 +1,6 @@ --- title: "Two Steps" +sidebar_label: "Two Steps" description: "Two Steps components for Compose diamonds." --- diff --git a/website/docs/library/access/Owner/index.mdx b/website/docs/library/access/Owner/index.mdx index 838542c3..b63ba2ec 100644 --- a/website/docs/library/access/Owner/index.mdx +++ b/website/docs/library/access/Owner/index.mdx @@ -1,5 +1,6 @@ --- title: "Owner" +sidebar_label: "Owner" description: "Single-owner access control pattern." --- diff --git a/website/docs/library/access/index.mdx b/website/docs/library/access/index.mdx index bc27733a..fd76a38f 100644 --- a/website/docs/library/access/index.mdx +++ b/website/docs/library/access/index.mdx @@ -1,5 +1,6 @@ --- -title: "Access Control" +title: "Access Control — Diamond Permission Management" +sidebar_label: "Access Control" description: "Access control patterns for permission management in Compose diamonds." --- @@ -7,8 +8,10 @@ import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; import DocSubtitle from '@site/src/components/docs/DocSubtitle'; import Icon from '@site/src/components/ui/Icon'; +# Diamond Permission Management + - Access control for Compose diamonds. + Manage who can access your diamond using Ownership or Role-Based Access Control diff --git a/website/docs/library/diamond/index.mdx b/website/docs/library/diamond/index.mdx index 65758b08..2268e125 100644 --- a/website/docs/library/diamond/index.mdx +++ b/website/docs/library/diamond/index.mdx @@ -1,5 +1,6 @@ --- -title: "Diamond Core" +title: "Diamond Core — Proxy Functionality" +sidebar_label: "Diamond Core" description: "Core diamond proxy functionality for ERC-2535 diamonds." --- @@ -7,6 +8,8 @@ import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; import DocSubtitle from '@site/src/components/docs/DocSubtitle'; import Icon from '@site/src/components/ui/Icon'; +# Diamond Core: Proxy Functionality + Core diamond proxy functionality for ERC-8153 diamonds. diff --git a/website/docs/library/index.mdx b/website/docs/library/index.mdx index 106b7077..f33d319a 100644 --- a/website/docs/library/index.mdx +++ b/website/docs/library/index.mdx @@ -1,5 +1,6 @@ --- -title: "Library" +title: "On-chain Contract Library" +sidebar_label: "Library" description: "Contract references for Compose modules and facets—interfaces, storage layout, and upgrade wiring." sidebar_class_name: "hidden" --- @@ -9,6 +10,8 @@ import DocSubtitle from '@site/src/components/docs/DocSubtitle'; import Icon from '@site/src/components/ui/Icon'; import Callout from '@site/src/components/ui/Callout'; +# Compose Smart Contracts Library + Contract-level docs for each **Compose** module and facet. What to call on-chain, how state is organized, and how upgrades work. diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index eb246476..4b9ad8e9 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -107,6 +107,28 @@ const config = { logo: 'https://compose.diamonds/img/logo.svg', }), }, + { + tagName: 'script', + attributes: { + type: 'application/ld+json', + }, + innerHTML: JSON.stringify({ + '@context': 'https://schema.org/', + '@type': 'WebSite', + name: 'Compose', + url: 'https://compose.diamonds/', + about: "Modular Smart Contract Library for ERC-2535 / ERC-8153 diamond proxies", + author: "Perfect Abstractions & the Compose Community", + potentialAction: { + '@type': 'SearchAction', + target: { + '@type': 'EntryPoint', + urlTemplate: 'https://compose.diamonds/?q={search_term_string}', + }, + 'query-input': 'required name=search_term_string', + }, + }), + }, { tagName: "meta", attributes: { @@ -161,6 +183,7 @@ const config = { /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ image: 'img/socialcard-compose.png', + titleTemplate: '%s | Compose', colorMode: { defaultMode: 'light', disableSwitch: false, @@ -329,6 +352,7 @@ const config = { }), plugins: [ path.join(__dirname, 'plugins', 'markdown-source-docs.js'), + path.join(__dirname, 'plugins', 'canonical-inject.js'), [ '@acid-info/docusaurus-og', { diff --git a/website/plugins/canonical-inject.js b/website/plugins/canonical-inject.js new file mode 100644 index 00000000..66962acb --- /dev/null +++ b/website/plugins/canonical-inject.js @@ -0,0 +1,75 @@ +/** + * Local plugin: injects into every HTML file after build. + * Guarantees the tag is in the initial server-rendered HTML — no JS required. + */ +import { createRequire } from 'module'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const require = createRequire(import.meta.url); +const fs = require('fs-extra'); + +function findHtmlFiles(dir) { + const results = []; + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const fullPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + results.push(...findHtmlFiles(fullPath)); + } else if (entry.name.endsWith('.html')) { + results.push(fullPath); + } + } + return results; +} + +/** + * Convert a file path relative to outDir into a URL path. + * e.g. "/docs/foundations/diamond-contracts/index.html" -> "/docs/foundations/diamond-contracts" + */ +function filePathToUrlPath(filePath, outDir) { + let rel = path.relative(outDir, filePath).split(path.sep).join('/'); + // /foo/index.html -> /foo + rel = rel.replace(/\/index\.html$/, ''); + // index.html -> / + if (rel === 'index') rel = ''; + return '/' + rel; +} + +export default function canonicalPlugin(context, options) { + const { url: siteUrl } = context.siteConfig; + const tag = ' into HTML files...'); + const htmlFiles = findHtmlFiles(outDir); + let count = 0; + + for (const filePath of htmlFiles) { + let html = fs.readFileSync(filePath, 'utf8'); + + // Skip if canonical already exists + if (html.includes(tag)) continue; + + const urlPath = filePathToUrlPath(filePath, outDir); + const canonical = `${siteUrl}${urlPath}`; + + // Inject right after or after the last in + const headIndex = html.indexOf(' of tag + const headClose = html.indexOf('>', headIndex); + const insertAt = headClose + 1; + + const canonicalTag = `\n `; + html = html.slice(0, insertAt) + canonicalTag + html.slice(insertAt); + + fs.writeFileSync(filePath, html, 'utf8'); + count++; + } + }, + }; +} diff --git a/website/src/pages/index.js b/website/src/pages/index.js index a9a71566..637c6064 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -9,7 +9,7 @@ import CtaSection from '../components/home/CtaSection'; export default function Home() { return (
diff --git a/website/src/theme/DocItem/Layout/index.js b/website/src/theme/DocItem/Layout/index.js index 456528b3..3a1552f4 100644 --- a/website/src/theme/DocItem/Layout/index.js +++ b/website/src/theme/DocItem/Layout/index.js @@ -15,6 +15,7 @@ import DocItemContent from '@theme/DocItem/Content'; import DocBreadcrumbs from '@theme/DocBreadcrumbs'; import ContentVisibility from '@theme/ContentVisibility'; import DocPageAside from '@site/src/components/docs/DocPageAside'; +import DocItemStructuredData from '@theme/DocItem/StructuredData'; import styles from './styles.module.css'; @@ -49,6 +50,7 @@ export default function DocItemLayout({ children }) { return (
+
+ + + ); +} diff --git a/website/static/robots.txt b/website/static/robots.txt index dd02d3d2..14e69940 100644 --- a/website/static/robots.txt +++ b/website/static/robots.txt @@ -1,25 +1,14 @@ # Robots.txt for Compose Documentation -# Allow all search engines to crawl the site User-agent: * Allow: / -# Disallow tag pages (low-value, duplicate content) Disallow: /tags/ - -# Disallow search pages (dynamic, no-index content) Disallow: /search - -# Disallow any admin or internal paths Disallow: /admin/ Disallow: /_next/ Disallow: /api/ -# Allow important content paths explicitly -Allow: /docs -Allow: /blog -Allow: / - # Sitemap location Sitemap: https://compose.diamonds/sitemap.xml