File size: 3,192 Bytes
743dad3
 
 
 
 
 
 
 
 
 
 
 
65ef364
 
743dad3
 
 
 
 
65ef364
743dad3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65ef364
743dad3
 
 
 
 
65ef364
743dad3
 
 
 
 
 
 
 
 
 
65ef364
743dad3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65ef364
 
 
743dad3
 
 
 
 
 
 
 
 
65ef364
 
743dad3
 
 
 
 
 
 
65ef364
 
 
743dad3
 
 
 
 
 
 
 
 
 
65ef364
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
import { Metadata } from "next";

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

export function generateSEO({
  title = "OmniDev | AI Project Builder",
  description = "OmniDev is an AI engineering environment that builds complete web projects (frontend + backend) from natural language.",
  path = "",
  image = "/banner.png",
  noIndex = false,
  canonical,
}: SEOParams = {}): Metadata {
  const baseUrl = process.env.PUBLIC_BASE_URL || "https://omnidev.hf.co";
  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: "OmniDev",
      images: [
        {
          url: `${baseUrl}${image}`,
          width: 1200,
          height: 630,
          alt: `${title} - OmniDev`,
        },
      ],
      locale: "en_US",
      type: "website",
    },
    twitter: {
      card: "summary_large_image",
      title,
      description,
      images: [`${baseUrl}${image}`],
      creator: "@omnidev",
    },
    other: {
      'X-Frame-Options': 'SAMEORIGIN',
      'og:image:secure_url': `${baseUrl}${image}`,
      '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: 'OmniDev',
        description: 'AI-powered full-stack project builder',
        url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co',
        applicationCategory: 'DeveloperApplication',
        operatingSystem: 'Web',
        offers: {
          '@type': 'Offer',
          price: '0',
          priceCurrency: 'USD',
        },
        creator: {
          '@type': 'Organization',
          name: 'OmniDev',
          url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co',
        },
        ...data,
      };
    
    case 'Organization':
      return {
        ...baseStructuredData,
        name: 'OmniDev',
        url: process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co',
        logo: `${process.env.PUBLIC_BASE_URL || 'https://omnidev.hf.co'}/logo.svg`,
        description: 'AI-powered web development platform',
        sameAs: [
        ],
        ...data,
      };
    
    default:
      return { ...baseStructuredData, ...data };
  }
}