|
38 | 38 | - [Formatting documentation](#formatting-documentation) |
39 | 39 | - [Adding content to "Examples" page](#adding-content-to-examples-page) |
40 | 40 | - [CLI and API reference - auto-generated content](#cli-and-api-reference---auto-generated-content) |
41 | | - - [CanonicalURL](#canonicalurl) |
42 | | - - [When to use CanonicalURL](#when-to-use-canonicalurl) |
43 | | - - [How to use CanonicalURL](#how-to-use-canonicalurl) |
44 | | - - [How to verify CanonicalURL is working](#how-to-verify-canonicalurl-is-working) |
45 | 41 |
|
46 | 42 | <!-- END doctoc generated TOC please keep comment here to allow auto update --> |
47 | 43 |
|
@@ -546,61 +542,3 @@ The `cmd/clidoc/main.go` is the general path for all Ory projects. |
546 | 542 |
|
547 | 543 | The command to generate the CLI docs can be found here: |
548 | 544 | https://github.com/ory/x/blob/master/clidoc/generate.go#L96 |
549 | | - |
550 | | -## CanonicalURL |
551 | | - |
552 | | -The `CanonicalURL` component specifies the authoritative URL for a page to |
553 | | -search engines. Docusaurus adds trailing slashes to `index.mdx` files and files |
554 | | -matching their parent directory names before Vercel's trailing slash removal |
555 | | -takes effect. This means search engines can crawl both versions (with and |
556 | | -without trailing slashes). The component ensures search engines know which |
557 | | -version is canonical by explicitly setting a URL without a trailing slash. |
558 | | - |
559 | | -### When to use CanonicalURL |
560 | | - |
561 | | -Use this component on: |
562 | | - |
563 | | -- **Any `index.mdx` file**: These files serve content at their parent path |
564 | | - (e.g., `/api/index.mdx`) |
565 | | -- **Files matching parent directory names**: When a file shares its parent |
566 | | - directory's name (e.g., `docs/kratos/organizations/organizations.mdx`) |
567 | | - |
568 | | -Common examples include: |
569 | | - |
570 | | -- Index Path (`/api/index.mdx`, `/elements/index.mdx`, `/identities/index.mdx`) |
571 | | -- Matching parent directory names |
572 | | - (`docs/kratos/organizations/organizations.mdx`, |
573 | | - `docs/self-hosted/oel/monitoring/monitoring.mdx`) |
574 | | - |
575 | | -### How to use CanonicalURL |
576 | | - |
577 | | -Add the component at the beginning of your MDX file after the front matter: |
578 | | - |
579 | | -````md |
580 | | ---- |
581 | | -id: your-page-id |
582 | | -title: Your Page Title |
583 | | ---- |
584 | | - |
585 | | -```mdx-code-block |
586 | | -import CanonicalURL from "@site/src/components/CanonicalUrl" |
587 | | -
|
588 | | -<CanonicalURL path="your/canonical/path" /> |
589 | | -
|
590 | | -Your content here... |
591 | | -``` |
592 | | -```` |
593 | | - |
594 | | -### How to verify CanonicalURL is working |
595 | | - |
596 | | -1. Open the page in your browser |
597 | | -2. Right-click and select "View Page Source" (not "Inspect") |
598 | | -3. Search for `<link rel="canonical"` in the HTML |
599 | | -4. Confirm the canonical URL exists and points to the correct path without |
600 | | - trailing slash |
601 | | - |
602 | | -Example: |
603 | | - |
604 | | -```html |
605 | | -<link rel="canonical" href="https://www.ory.com/docs/kratos/organizations" /> |
606 | | -``` |
0 commit comments