Skip to content

Commit c8ba38b

Browse files
committed
docs: improve website SEO metadata
1 parent dd40662 commit c8ba38b

File tree

28 files changed

+184
-13
lines changed

28 files changed

+184
-13
lines changed

docs/website/.vitepress/config.mts

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,82 @@
1-
import { defineConfig } from 'vitepress'
1+
import { defineConfig, type HeadConfig } from 'vitepress'
22
import { version } from './_data/assets.json'
33

4+
const siteUrl = 'https://masscode.io'
5+
const siteTitle = 'massCode'
46
const description = 'Free, open-source developer workspace with code snippets, markdown notes, math notebook, and built-in dev tools.'
5-
const ogDescription = 'Free, open-source developer workspace: code snippets, notes, math notebook, and 20+ dev tools. All data stored locally.'
6-
const ogImage = 'https://masscode.io/og-image.png'
7-
const ogTitle = 'massCode'
8-
const ogUrl = 'https://masscode.io'
7+
const ogImage = `${siteUrl}/og-image.png`
98
const gsv = 'h-rU1tSutO83wOyvi4syrk_XTvgennlUPkL6fMmq5cI'
109

10+
function resolvePagePath(relativePath: string) {
11+
if (!relativePath || relativePath === 'index.md')
12+
return '/'
13+
14+
if (relativePath.endsWith('/index.md'))
15+
return `/${relativePath.slice(0, -'index.md'.length)}`
16+
17+
return `/${relativePath.replace(/\.md$/, '.html')}`
18+
}
19+
20+
function resolvePageUrl(relativePath: string) {
21+
return new URL(resolvePagePath(relativePath), siteUrl).toString()
22+
}
23+
24+
function buildSeoHead({
25+
relativePath,
26+
pageTitle,
27+
pageDescription,
28+
isNotFound,
29+
}: {
30+
relativePath: string
31+
pageTitle: string
32+
pageDescription: string
33+
isNotFound?: boolean
34+
}): HeadConfig[] {
35+
if (isNotFound)
36+
return [['meta', { name: 'robots', content: 'noindex, nofollow' }]]
37+
38+
const pageUrl = resolvePageUrl(relativePath)
39+
40+
return [
41+
['link', { rel: 'canonical', href: pageUrl }],
42+
['meta', { property: 'og:type', content: 'website' }],
43+
['meta', { property: 'og:site_name', content: siteTitle }],
44+
['meta', { property: 'og:title', content: pageTitle }],
45+
['meta', { property: 'og:description', content: pageDescription }],
46+
['meta', { property: 'og:url', content: pageUrl }],
47+
['meta', { property: 'og:image', content: ogImage }],
48+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
49+
['meta', { name: 'twitter:title', content: pageTitle }],
50+
['meta', { name: 'twitter:description', content: pageDescription }],
51+
['meta', { name: 'twitter:image', content: ogImage }],
52+
]
53+
}
54+
1155
export default defineConfig({
12-
title: 'massCode',
56+
title: siteTitle,
1357
description,
1458

59+
sitemap: {
60+
hostname: siteUrl,
61+
transformItems(items) {
62+
return items.filter(item => !item.url.endsWith('/404.html'))
63+
},
64+
},
65+
1566
head: [
1667
['link', { rel: 'icon', type: 'image/png', href: '/logo-64w.png' }],
17-
['meta', { property: 'og:type', content: 'website' }],
18-
['meta', { property: 'og:title', content: ogTitle }],
19-
['meta', { property: 'og:image', content: ogImage }],
20-
['meta', { property: 'og:url', content: ogUrl }],
21-
['meta', { property: 'og:description', content: ogDescription }],
22-
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
2368
['meta', { name: 'google-site-verification', content: gsv }],
2469
],
2570

71+
transformHead({ pageData, title, description }) {
72+
return buildSeoHead({
73+
relativePath: pageData.relativePath,
74+
pageTitle: title,
75+
pageDescription: description,
76+
isNotFound: pageData.isNotFound,
77+
})
78+
},
79+
2680
themeConfig: {
2781
logo: '/logo-64w.png',
2882

docs/website/documentation/code/description.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Snippet Descriptions
3+
description: "Add descriptions to massCode snippets to store usage notes, caveats, links, and extra context next to your code."
4+
---
5+
16
# Description
27

38
Descriptions give extra context when the code alone is not enough. Use them for usage notes, caveats, links, or a short explanation of what the snippet does.

docs/website/documentation/code/folders.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Folders
3+
description: "Organize snippets in massCode with nested folders, renaming, moving, and deletion workflows in the Code space."
4+
---
5+
16
# Folders
27

38
Folders help you organize snippets by project, topic, language, or any structure that fits your workflow. When you select a folder in the sidebar, massCode shows snippets from that folder and all of its subfolders in the second column.

docs/website/documentation/code/fragments.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Snippet Fragments
3+
description: "Use snippet fragments in massCode to keep multiple related files, languages, or versions together in one snippet."
4+
---
5+
16
# Fragments
27

38
Fragments are tabs inside a snippet. Use them when one snippet needs multiple related versions, files, or languages in one place.

docs/website/documentation/code/library.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Library
3+
description: "Browse the Code Library in massCode, including Inbox, Favorites, All Snippets, and Trash for fast snippet navigation."
4+
---
5+
16
# Library
27

38
The Library is the first column in the Code space. It gives you a fast way to browse system folders and jump to the part of your snippet collection you need.

docs/website/documentation/code/search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Search
3+
description: "Search the entire massCode snippet library by title or content to quickly find saved code across folders."
4+
---
5+
16
# Search
27

38
Search helps you find snippets by title or content across your entire library. Use it when you remember part of the code but not where you saved it.

docs/website/documentation/code/snippets.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Snippets
3+
description: "Save, organize, and edit reusable code snippets in massCode with folders, languages, and searchable snippet content."
4+
---
5+
16
# Snippets
27

38
Snippets are the core building blocks of the Code space. Use them to save code you reuse across projects, keep reference examples close at hand, and build your own searchable code library over time.

docs/website/documentation/code/tags.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Code Tags
3+
description: "Use tags in massCode to organize snippets across folders, add tag filters, and manage tag deletion safely."
4+
---
5+
16
# Tags
27

38
Tags are a flexible way to organize snippets across folders. Unlike folders, a snippet can have multiple tags at the same time.

docs/website/documentation/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Documentation Overview
3+
description: "Explore the massCode documentation for code snippets, markdown notes, math notebook, storage, sync, themes, and built-in developer tools."
4+
---
5+
16
# Overview
27

38
massCode is a free and open source developer workspace for code snippets, markdown notes, calculations, and quick developer utilities. Instead of scattering everyday work across an editor, a notes app, a calculator, and a handful of websites, you keep it in four focused Spaces inside one local-first desktop app.

docs/website/documentation/math/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
title: Math Notebook
3+
description: "Use the massCode Math Notebook for natural-language calculations, conversions, currency rates, finance, and date math."
4+
---
5+
16
# Math Notebook
27

38
<AppVersion text=">=4.6" />

0 commit comments

Comments
 (0)