Skip to content

Commit 0a7da1a

Browse files
committed
Generate og images & adjust color
1 parent d302b64 commit 0a7da1a

File tree

14 files changed

+833
-24
lines changed

14 files changed

+833
-24
lines changed

docs/.vitepress/config.mts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
import { buildEndGenerateOpenGraphImages } from '@nolebase/vitepress-plugin-og-image'
2+
import fs from 'fs-extra'
3+
import { createRequire } from 'node:module'
4+
import path from 'path'
15
import { defineConfig } from 'vitepress'
26
import llmstxt from 'vitepress-plugin-llms'
37
import { availableSinceMarkdownPlugin } from './availableSinceMarkdownPlugin'
@@ -6,7 +10,9 @@ import { tabsMarkdownPlugin } from './vitepress-plugin-tabs/tabsMarkdownPlugin'
610
const title = 'Inertia Rails'
711
const description = 'Documentation for Inertia.js Rails adapter'
812
const site = 'https://inertia-rails.dev'
9-
const image = `${site}/og_image.jpg`
13+
14+
const image = `${site}/og-image.png`
15+
const require = createRequire(import.meta.url)
1016

1117
// https://vitepress.dev/reference/site-config
1218
export default defineConfig({
@@ -215,4 +221,40 @@ export default defineConfig({
215221
{ icon: 'discord', link: 'https://discord.gg/inertiajs' },
216222
],
217223
},
224+
async buildEnd(siteconfig) {
225+
async function loadSvgFontBuffers() {
226+
const interFontFilesDirectoryPath = path.join(
227+
require.resolve('@fontsource/inter'),
228+
'..',
229+
'files',
230+
)
231+
const interFontFilePaths = [
232+
'inter-latin-500-normal.woff2',
233+
'inter-latin-800-normal.woff2',
234+
]
235+
236+
return await Promise.all(
237+
interFontFilePaths.map((filename) =>
238+
fs.readFile(path.join(interFontFilesDirectoryPath, filename)),
239+
),
240+
)
241+
}
242+
243+
await buildEndGenerateOpenGraphImages({
244+
baseUrl: 'https://inertia-rails.dev',
245+
svgFontBuffers: await loadSvgFontBuffers(),
246+
category: {
247+
byPathPrefix: [
248+
{
249+
prefix: '/guide',
250+
text: 'Guide',
251+
},
252+
{
253+
prefix: '/cookbook',
254+
text: 'Cookbook',
255+
},
256+
],
257+
},
258+
})(siteconfig)
259+
},
218260
})

docs/.vitepress/theme/style.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
--vp-c-default-2: var(--vp-c-gray-2);
4949
--vp-c-default-3: var(--vp-c-gray-3);
5050
--vp-c-default-soft: var(--vp-c-gray-soft);
51-
--vp-c-brand-1: rgb(37 99 235);
52-
--vp-c-brand-2: rgb(52 109 243);
53-
--vp-c-brand-3: rgb(68 125 259);
51+
--vp-c-brand-1: rgb(37, 99, 235);
52+
--vp-c-brand-2: rgb(53 109 243);
53+
--vp-c-brand-3: rgb(69 125 260);
5454
--vp-c-brand-soft: var(--vp-c-purple-soft);
5555

5656
--vp-c-tip-1: var(--vp-c-brand-1);
@@ -76,13 +76,13 @@
7676
:root {
7777
--vp-button-brand-border: transparent;
7878
--vp-button-brand-text: var(--vp-c-white);
79-
--vp-button-brand-bg: var(--vp-c-brand-3);
79+
--vp-button-brand-bg: var(--vp-c-brand-1);
8080
--vp-button-brand-hover-border: transparent;
8181
--vp-button-brand-hover-text: var(--vp-c-white);
8282
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
8383
--vp-button-brand-active-border: transparent;
8484
--vp-button-brand-active-text: var(--vp-c-white);
85-
--vp-button-brand-active-bg: var(--vp-c-brand-1);
85+
--vp-button-brand-active-bg: var(--vp-c-brand-3);
8686
}
8787

8888
/**
File renamed without changes.

docs/guide/demo-application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ We've setup a demo app for Inertia.js called [Ping CRM](https://demo.inertiajs.c
55
> [!NOTE]
66
> The Ping CRM demo is hosted on Heroku and the database is reset every hour. Please be respectful when editing data.
77
8-
[![Ping CRM demo](/pingcrm.png)](https://demo.inertiajs.com/login)
8+
[![Ping CRM demo](/images/pingcrm.png)](https://demo.inertiajs.com/login)
99

1010
In addition to the Vue version of Ping CRM, we also maintain a Svelte version of the application, which you can find [on GitHub](https://github.com/inertiajs/pingcrm-svelte).
1111

0 commit comments

Comments
 (0)