Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

add template page metas (#308)

Guy Ben-Aharon1880789b0f86
diff --git a/src/lib/env.ts b/src/lib/env.ts
index 95ec41b4..8731314c 100644
--- a/src/lib/env.ts
+++ b/src/lib/env.ts
@@ -2,3 +2,4 @@ export const OPENAI_API_KEY: string = import.meta.env.VITE_OPENAI_API_KEY;
export const IS_CHARTDB_IO: boolean =
import.meta.env.VITE_IS_CHARTDB_IO === 'true';
export const APP_URL: string = import.meta.env.VITE_APP_URL;
+export const HOST_URL: string = import.meta.env.VITE_HOST_URL ?? '';
diff --git a/src/pages/template-page/template-page.tsx b/src/pages/template-page/template-page.tsx
index 0b6e2218..f16a8f61 100644
--- a/src/pages/template-page/template-page.tsx
+++ b/src/pages/template-page/template-page.tsx
@@ -31,7 +31,7 @@ import { Canvas } from '../editor-page/canvas/canvas';
import { ReactFlowProvider } from '@xyflow/react';
import { ChartDBProvider } from '@/context/chartdb-context/chartdb-provider';
import { Helmet } from 'react-helmet-async';
-import { APP_URL } from '@/lib/env';
+import { APP_URL, HOST_URL } from '@/lib/env';
export interface TemplatePageLoaderData {
template: Template | undefined;
@@ -63,11 +63,58 @@ const TemplatePageComponent: React.FC = () => {
return (
<>
<Helmet>
- <title>
- {template
- ? `ChartDB - ${template.name} - ${template.shortDescription}`
- : 'ChartDB - Database Schema Template'}
- </title>
+ {template ? (
+ <>
+ <title>
+ Database schema diagram for {template.name} |
+ ChartDB
+ </title>
+ <meta
+ name="title"
+ content={`Database schema for - ${template.name} | ChartDB`}
+ />
+ <meta
+ name="description"
+ content={`${template.shortDescription}: ${template.description}`}
+ />
+ <meta
+ name="keywords"
+ content={`${template.keywords.join(', ')}`}
+ />
+ <meta
+ property="og:title"
+ content={`Database schema for - ${template.name} | ChartDB`}
+ />
+ <meta
+ property="og:description"
+ content={`${template.shortDescription}: ${template.description}`}
+ />
+ <meta
+ property="og:image"
+ content={`${HOST_URL}${template.image}`}
+ />
+ <meta property="og:type" content="website" />
+
+ <meta
+ name="twitter:title"
+ content={`Database schema for - ${template.name} | ChartDB`}
+ />
+ <meta
+ name="twitter:description"
+ content={`${template.shortDescription}: ${template.description}`}
+ />
+ <meta
+ name="twitter:image"
+ content={`${HOST_URL}${template.image}`}
+ />
+ <meta
+ name="twitter:card"
+ content="summary_large_image"
+ />
+ </>
+ ) : (
+ <title>Database Schema Diagram | ChartDB</title>
+ )}
</Helmet>
<section className="flex h-screen w-screen flex-col bg-background">
diff --git a/vite.config.ts b/vite.config.ts
index b24a23f3..a22e6f63 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -30,4 +30,21 @@ export default defineConfig({
'@': path.resolve(__dirname, './src'),
},
},
+ build: {
+ rollupOptions: {
+ output: {
+ assetFileNames: (assetInfo) => {
+ if (
+ assetInfo.names &&
+ assetInfo.originalFileNames.some((name) =>
+ name.startsWith('src/assets/templates/')
+ )
+ ) {
+ return 'assets/[name][extname]';
+ }
+ return 'assets/[name]-[hash][extname]';
+ },
+ },
+ },
+ },
});