File size: 3,300 Bytes
279aea8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* eslint-disable @typescript-eslint/no-explicit-any */
import { Metadata } from "next";

interface SEOParams {
  title?: string;
  description?: string;
  path?: string;
  image?: string;
  noIndex?: boolean;
  canonical?: string;
}

export function generateSEO({
  title = "DeepSite | Build with AI ✨",
  description = "DeepSite is a web development tool that helps you build websites with AI, no code required. Let's deploy your website with DeepSite and enjoy the magic of AI.",
  path = "",
  image = "/banner.png",
  noIndex = false,
  canonical,
}: SEOParams = {}): Metadata {
  const baseUrl = "https://huggingface.co/deepsite";
  const fullUrl = `${baseUrl}${path}`;
  const canonicalUrl = canonical || fullUrl;

  return {
    title,
    description,
    alternates: {
      canonical: canonicalUrl,
    },
    robots: noIndex
      ? {
          index: false,
          follow: false,
          googleBot: {
            index: false,
            follow: false,
            "max-video-preview": -1,
            "max-image-preview": "large",
            "max-snippet": -1,
          },
        }
      : {
          index: true,
          follow: true,
          googleBot: {
            index: true,
            follow: true,
            "max-video-preview": -1,
            "max-image-preview": "large",
            "max-snippet": -1,
          },
        },
    openGraph: {
      title,
      description,
      url: canonicalUrl,
      siteName: "DeepSite",
      images: [
        {
          url: `${baseUrl}${image}`,
          width: 1200,
          height: 630,
          alt: `${title} - DeepSite`,
        },
      ],
      locale: "en_US",
      type: "website",
    },
    twitter: {
      card: "summary_large_image",
      title,
      description,
      images: [`${baseUrl}${image}`],
      creator: "@deepsite",
    },
    other: {
      // Control how the page appears when shared
      "og:image:secure_url": `${baseUrl}${image}`,
      // Help search engines understand the primary URL
      rel: "canonical",
    },
  };
}

export function generateStructuredData(
  type: "WebApplication" | "Organization" | "Article",
  data: any
) {
  const baseStructuredData = {
    "@context": "https://schema.org",
    "@type": type,
  };

  switch (type) {
    case "WebApplication":
      return {
        ...baseStructuredData,
        name: "DeepSite",
        description: "Build websites with AI, no code required",
        url: "https://huggingface.co/deepsite",
        applicationCategory: "DeveloperApplication",
        operatingSystem: "Web",
        offers: {
          "@type": "Offer",
          price: "0",
          priceCurrency: "USD",
        },
        creator: {
          "@type": "Organization",
          name: "DeepSite",
          url: "https://huggingface.co/deepsite",
        },
        ...data,
      };

    case "Organization":
      return {
        ...baseStructuredData,
        name: "DeepSite",
        url: "https://huggingface.co/deepsite",
        logo: "https://huggingface.co/deepsite/logo.svg",
        description: "AI-powered web development platform",
        sameAs: [
          // Add social media links here if available
        ],
        ...data,
      };

    default:
      return { ...baseStructuredData, ...data };
  }
}