Skip to content

Commit bd4b87f

Browse files
authored
Merge pull request #2403 from hey-api/docs/seo
docs: SEO improvements
2 parents 197ed86 + b0c19b6 commit bd4b87f

File tree

9 files changed

+69
-29
lines changed

9 files changed

+69
-29
lines changed

docs/.vitepress/config/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,5 @@ export default defineConfig({
305305
},
306306
],
307307
},
308+
title: 'Hey API',
308309
});

docs/.vitepress/config/shared.ts

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { defineConfig, type HeadConfig } from 'vitepress';
22

3+
const domain = process.env.SITE_DOMAIN || 'http://localhost:5173';
4+
35
export default defineConfig({
46
cleanUrls: true,
57
head: [
@@ -30,19 +32,6 @@ export default defineConfig({
3032
type: 'image/png',
3133
},
3234
],
33-
['meta', { content: 'website', property: 'og:type' }],
34-
['meta', { content: 'en', property: 'og:locale' }],
35-
[
36-
'meta',
37-
{
38-
content:
39-
'🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.',
40-
property: 'og:title',
41-
},
42-
],
43-
['meta', { content: 'OpenAPI TypeScript', property: 'og:site_name' }],
44-
['meta', { content: '/images/logo-640w.png', property: 'og:image' }],
45-
['meta', { content: 'https://heyapi.dev', property: 'og:url' }],
4635
[
4736
'script',
4837
{},
@@ -52,10 +41,14 @@ export default defineConfig({
5241
'script',
5342
{ defer: '', src: '/_vercel/insights/script.js' },
5443
],
55-
].filter(Boolean) as HeadConfig[],
56-
lastUpdated: false,
44+
].filter(Boolean) as Array<HeadConfig>,
45+
lastUpdated: true,
5746
sitemap: {
58-
hostname: 'https://heyapi.dev',
47+
hostname: domain,
48+
lastmodDateOnly: true,
49+
// filter out everything but index and `openapi-ts` pages
50+
transformItems: (items) =>
51+
items.filter((item) => !item.url || item.url.startsWith('openapi-ts')),
5952
},
6053
themeConfig: {
6154
externalLinkIcon: true,
@@ -69,5 +62,41 @@ export default defineConfig({
6962
{ icon: 'github', link: 'https://github.com/hey-api/openapi-ts' },
7063
],
7164
},
72-
title: 'Hey API',
65+
transformPageData: (pageData, context) => {
66+
pageData.frontmatter.head ??= [];
67+
68+
const canonicalUrl = pageData.relativePath
69+
.replace(/index\.md$/, '')
70+
.replace(/\.md$/, context.siteConfig.cleanUrls ? '' : '.html');
71+
const url = `${domain}/${canonicalUrl}`;
72+
73+
const head: Array<HeadConfig> = pageData.frontmatter.head;
74+
head.unshift(
75+
['link', { href: url, rel: 'canonical' }],
76+
['meta', { content: 'website', property: 'og:type' }],
77+
['meta', { content: 'en_US', property: 'og:locale' }],
78+
['meta', { content: 'Hey API', property: 'og:site_name' }],
79+
[
80+
'meta',
81+
{ content: `${domain}/images/logo-640w.png`, property: 'og:image' },
82+
],
83+
['meta', { content: url, property: 'og:url' }],
84+
[
85+
'meta',
86+
{
87+
content:
88+
pageData.frontmatter.description ||
89+
'🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.',
90+
property: 'og:description',
91+
},
92+
],
93+
[
94+
'meta',
95+
{
96+
content: pageData.frontmatter.title || 'OpenAPI TypeScript',
97+
property: 'og:title',
98+
},
99+
],
100+
);
101+
},
73102
});

docs/openapi-ts/plugins/fastify.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Fastify
3-
description: Fastify plugin for Hey API. Compatible with all our features.
2+
title: Fastify v5 Plugin
3+
description: Generate Fastify v5 route handlers from OpenAPI with the Fastify plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<Heading>
@@ -30,6 +30,7 @@ StackBlitz
3030

3131
## Features
3232

33+
- Fastify v5 support
3334
- seamless integration with `@hey-api/openapi-ts` ecosystem
3435
- type-safe route handlers
3536
- minimal learning curve thanks to extending the underlying technology

docs/openapi-ts/plugins/tanstack-query.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: TanStack Query
3-
description: TanStack Query plugin for Hey API. Compatible with all our features.
2+
title: TanStack Query v5 Plugin
3+
description: Generate TanStack Query v5 functions and query keys from OpenAPI with the TanStack Query plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<script setup lang="ts">
@@ -24,6 +24,7 @@ Launch demo
2424

2525
## Features
2626

27+
- TanStack Query v5 support
2728
- seamless integration with `@hey-api/openapi-ts` ecosystem
2829
- create query keys following the best practices
2930
- type-safe query options, infinite query options, and mutation options

docs/openapi-ts/plugins/valibot.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Valibot
3-
description: Valibot plugin for Hey API. Compatible with all our features.
2+
title: Valibot v1 Plugin
3+
description: Generate Valibot v1 schemas from OpenAPI with the Valibot plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<!-- <script setup lang="ts">
@@ -24,6 +24,7 @@ Launch demo
2424

2525
## Features
2626

27+
- Valibot v1 support
2728
- seamless integration with `@hey-api/openapi-ts` ecosystem
2829
- Valibot schemas for requests, responses, and reusable definitions
2930

docs/openapi-ts/plugins/zod.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Zod
3-
description: Zod plugin for Hey API. Compatible with all our features.
2+
title: Zod v4 Plugin
3+
description: Generate Zod v4 schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<script setup lang="ts">
@@ -24,6 +24,7 @@ Launch demo
2424

2525
## Features
2626

27+
- Zod v4 support
2728
- seamless integration with `@hey-api/openapi-ts` ecosystem
2829
- Zod schemas for requests, responses, and reusable definitions
2930

docs/openapi-ts/plugins/zod/mini.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Zod
3-
description: Zod plugin for Hey API. Compatible with all our features.
2+
title: Zod Mini Plugin
3+
description: Generate Zod Mini schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<script setup lang="ts">
@@ -24,6 +24,7 @@ Launch demo
2424

2525
## Features
2626

27+
- Zod Mini support
2728
- seamless integration with `@hey-api/openapi-ts` ecosystem
2829
- Zod schemas for requests, responses, and reusable definitions
2930

docs/openapi-ts/plugins/zod/v3.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Zod
3-
description: Zod plugin for Hey API. Compatible with all our features.
2+
title: Zod v3 Plugin
3+
description: Generate Zod v3 schemas from OpenAPI with the Zod plugin for openapi-ts. Fully compatible with validators, transformers, and all core features.
44
---
55

66
<script setup lang="ts">
@@ -24,6 +24,7 @@ Launch demo
2424

2525
## Features
2626

27+
- Zod v3 support
2728
- seamless integration with `@hey-api/openapi-ts` ecosystem
2829
- Zod schemas for requests, responses, and reusable definitions
2930

docs/public/robots.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
User-agent: *
2+
Allow: /
3+
4+
Sitemap: https://heyapi.dev/sitemap.xml

0 commit comments

Comments
 (0)