Skip to content

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

add canonical link to templates (#327)

Guy Ben-Aharon3d3efc5e824e
diff --git a/src/pages/template-page/template-page.tsx b/src/pages/template-page/template-page.tsx
index 9965a27b..c7c5cc10 100644
--- a/src/pages/template-page/template-page.tsx
+++ b/src/pages/template-page/template-page.tsx
@@ -69,6 +69,12 @@ const TemplatePageComponent: React.FC = () => {
Database schema diagram for {template.name} |
ChartDB
</title>
+ {HOST_URL !== 'https://chartdb.io' ? (
+ <link
+ rel="canonical"
+ href={`https://chartdb.io/templates/${templateSlug}`}
+ />
+ ) : null}
<meta
name="title"
content={`Database schema for - ${template.name} | ChartDB`}
diff --git a/src/pages/templates-page/templates-page.tsx b/src/pages/templates-page/templates-page.tsx
index 658f8569..200fa387 100644
--- a/src/pages/templates-page/templates-page.tsx
+++ b/src/pages/templates-page/templates-page.tsx
@@ -11,6 +11,7 @@ import { useLoaderData, useMatches, useParams } from 'react-router-dom';
import type { Template } from '@/templates-data/templates-data';
import { Spinner } from '@/components/spinner/spinner';
import { Helmet } from 'react-helmet-async';
+import { HOST_URL } from '@/lib/env';
export interface TemplatesPageLoaderData {
templates: Template[] | undefined;
@@ -33,6 +34,9 @@ const TemplatesPageComponent: React.FC = () => {
<>
<Helmet>
<title>ChartDB - Database Schema Templates</title>
+ {HOST_URL !== 'https://chartdb.io' ? (
+ <link rel="canonical" href="https://chartdb.io/templates" />
+ ) : null}
</Helmet>
<section className="flex w-screen flex-col bg-background">