Skip to content

Commit 3da2724

Browse files
authored
docs: add meta tags and generate sitemap (#841)
1 parent ec966a5 commit 3da2724

File tree

10 files changed

+186
-62
lines changed

10 files changed

+186
-62
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
run: pnpm i && pnpm dev:prepare
6363

6464
# Build docs
65-
- run: cd docs && pnpm docs:build
65+
- run: pnpm docs:build
6666

6767
test-playground-local:
6868
runs-on: ubuntu-latest

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: pnpm i
5252

5353
- name: Build with VitePress
54-
run: cd docs/ && pnpm docs:build
54+
run: pnpm docs:build
5555

5656
- name: Upload artifact
5757
uses: actions/upload-pages-artifact@v3

docs/.vitepress/config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from 'vitepress'
22
import { routes as navRoutes } from './routes/navbar'
33
import { routes as sidebarRoutes } from './routes/sidebar'
4+
import { headConfig, sitemapConfig } from './head'
45

56
export default defineConfig({
67
title: 'NuxtAuth',
@@ -11,7 +12,8 @@ export default defineConfig({
1112
lang: 'en-US',
1213
appearance: 'dark',
1314
lastUpdated: true,
14-
head: [['link', { rel: 'icon', href: '/favicon.ico' }]],
15+
head: headConfig,
16+
sitemap: sitemapConfig,
1517
themeConfig: {
1618
logo: '/lock.png',
1719
outline: { level: 'deep' },

docs/.vitepress/head.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { HeadConfig } from "vitepress"
2+
3+
const HOST_NAME = 'https://auth.sidebase.io'
4+
const OG_IMAGE_URL = `${HOST_NAME}/nuxt-auth-og.jpg`
5+
6+
export const sitemapConfig = {
7+
hostname: HOST_NAME
8+
}
9+
10+
export const headConfig: HeadConfig[] = [
11+
['link', { rel: 'icon', href: '/favicon.ico' }],
12+
['meta', { name: 'theme-color', content: '#30A36C' }],
13+
['meta', { property: 'og:title', content: 'NuxtAuth | Authentication for Nuxt 3' }],
14+
['meta', { property: 'og:description', content: 'User authentication and sessions via authjs' }],
15+
['meta', { property: 'og:site_name', content: 'NuxtAuth' }],
16+
['meta', { property: 'og:type', content: 'website' }],
17+
['meta', { property: 'og:locale', content: 'en' }],
18+
['meta', { property: 'og:image', content: OG_IMAGE_URL }],
19+
['meta', { property: 'og:url', content: HOST_NAME }],
20+
]

docs/.vitepress/theme/Layout.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme'
3+
import GithubStarsButton from './components/GithubStarsButton.vue'
4+
import Banner from './components/Banner.vue'
5+
6+
const { Layout } = DefaultTheme
7+
8+
// Banner Configuration
9+
const bannerConfig = {
10+
// Leave text empty to disable the banner
11+
text: '✨ NuxtAuth v0.8.0 has been released! ✨',
12+
button: {
13+
href: 'https://github.com/sidebase/nuxt-auth/releases/tag/0.8.0',
14+
text: 'View release notes'
15+
}
16+
}
17+
</script>
18+
19+
<template>
20+
<Layout>
21+
<template #nav-bar-content-after>
22+
<GithubStarsButton owner="sidebase" repo="nuxt-auth" />
23+
</template>
24+
25+
<template #home-hero-before>
26+
<Banner v-bind="bannerConfig" />
27+
</template>
28+
</Layout>
29+
</template>

docs/.vitepress/theme/index.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
// https://vitepress.dev/guide/custom-theme
2-
import { h } from 'vue'
32
import type { Theme } from 'vitepress'
43
import DefaultTheme from 'vitepress/theme'
4+
import Layout from './Layout.vue'
55

66
// Styles
77
import './style.css'
88

9-
// Custom Components
10-
import GithubStarsButton from './components/GithubStarsButton.vue'
11-
import Banner from './components/Banner.vue'
12-
13-
// Configuration
14-
const bannerConfig = {
15-
// Leave text empty to disable the banner
16-
text: '✨ NuxtAuth v0.8.0 has been released! ✨',
17-
button: {
18-
href: 'https://github.com/sidebase/nuxt-auth/releases/tag/0.8.0',
19-
text: 'View release notes'
20-
}
21-
}
22-
23-
export default {
24-
extends: DefaultTheme,
25-
Layout: () => {
26-
return h(DefaultTheme.Layout, null, {
27-
// https://vitepress.dev/guide/extending-default-theme#layout-slots
28-
'nav-bar-content-after': h(GithubStarsButton, { owner: 'sidebase', repo: 'nuxt-auth' }),
29-
'home-hero-before': h(Banner, bannerConfig)
30-
})
31-
},
32-
} satisfies Theme
9+
export default { extends: DefaultTheme, Layout } satisfies Theme

docs/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

docs/public/nuxt-auth-og.jpg

99.9 KB
Loading

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
"typecheck": "nuxi prepare playground-local && tsc --noEmit",
2828
"typecheck:refresh": "nuxi prepare playground-refresh && tsc --noEmit",
2929
"dev:prepare": "nuxt-module-build build --stub",
30-
"docs:dev": "cd ./docs && pnpm docs:dev"
30+
"docs:dev": "vitepress dev docs",
31+
"docs:build": "vitepress build docs",
32+
"docs:preview": "vitepress preview docs"
3133
},
3234
"dependencies": {
3335
"@nuxt/kit": "^3.12.4",
@@ -51,6 +53,7 @@
5153
"ofetch": "^1.3.4",
5254
"ts-essentials": "^9.4.2",
5355
"typescript": "^5.5.4",
56+
"vitepress": "^1.3.1",
5457
"vue-tsc": "^2.0.29"
5558
},
5659
"overrides": {

0 commit comments

Comments
 (0)