Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: added default SEO for all pages in _app.tsx.

Jonathan Summers-Muir4fac214c6772
diff --git a/www/components/Meta.tsx b/www/components/Favicons.tsx
similarity index 61%
rename from www/components/Meta.tsx
rename to www/components/Favicons.tsx
index 414c9a979cd..5c65346f0fa 100644
--- a/www/components/Meta.tsx
+++ b/www/components/Favicons.tsx
@@ -1,8 +1,7 @@
import Head from 'next/head'
-import { DESCRIPTION } from '../lib/constants'
import { useRouter } from 'next/router'
-const Meta = () => {
+const Favicons = () => {
const { basePath } = useRouter()
return (
<Head>
@@ -30,23 +29,10 @@ const Meta = () => {
<meta name="msapplication-config" content={`${basePath}/favicon/browserconfig.xml`} />
<meta name="theme-color" content="#1E1E1E" />
<link rel="alternate" type="application/rss+xml" href={`${basePath}/feed.xml`} />
-
- <meta name="description" content={DESCRIPTION} />
- <meta property="og:type" content="website" />
-
- <meta name="og:description" property="og:description" content={DESCRIPTION} />
- <meta property="og:site_name" content="" />
- <meta property="og:url" content={`${basePath}/og/og-image.jpg`} />
- <meta name="twitter:card" content="summary_large_image" />
- <meta name="twitter:title" content="" />
- <meta name="twitter:description" content={DESCRIPTION} />
- <meta name="twitter:creator" content="supabase_io" />
<link rel="icon" type="image/png" href={`${basePath}/favicon/favicon.ico`} />
<link rel="apple-touch-icon" href={`${basePath}/favicon/favicon.ico`} />
- <meta property="og:image" content={`${basePath}/og/og-image.jpg`} />
- <meta name="twitter:image" content={`https://supabase.io${basePath}/og/og-image.jpg`} />
</Head>
)
}
-export default Meta
+export default Favicons
diff --git a/www/components/Layouts/Default.tsx b/www/components/Layouts/Default.tsx
index fe1df2a256c..b9b05d42096 100644
--- a/www/components/Layouts/Default.tsx
+++ b/www/components/Layouts/Default.tsx
@@ -1,7 +1,6 @@
import { useState, useEffect } from 'react'
import Nav from 'components/Nav/index'
import Footer from 'components/Footer/index'
-import Meta from 'components/Meta'
type Props = {
hideHeader?: boolean
@@ -28,7 +27,6 @@ const DefaultLayout = (props: Props) => {
return (
<>
- <Meta />
{!hideHeader && <Nav darkMode={darkMode} />}
<div className="min-h-screen bg-gray-50 dark:bg-gray-800">
<main>{children}</main>
diff --git a/www/pages/_app.tsx b/www/pages/_app.tsx
index 890778ceeeb..15fb6fd84d2 100644
--- a/www/pages/_app.tsx
+++ b/www/pages/_app.tsx
@@ -1,8 +1,11 @@
+import { DefaultSeo } from 'next-seo'
+import Meta from '~/components/Favicons'
import { AppProps } from 'next/app'
import { useRouter } from 'next/router'
import { useEffect } from 'react'
import '../styles/index.css'
import { post } from './../lib/fetchWrapper'
+import { APP_NAME, DESCRIPTION } from 'lib/constants'
export default function MyApp({ Component, pageProps }: AppProps) {
const router = useRouter()
@@ -35,5 +38,35 @@ export default function MyApp({ Component, pageProps }: AppProps) {
}
}, [router.events])
- return <Component {...pageProps} />
+ const site_title = `The Open Source Firebase Alternative | ${APP_NAME}`
+ const { basePath } = useRouter()
+
+ return (
+ <>
+ <Meta />
+ <DefaultSeo
+ title={site_title}
+ description={DESCRIPTION}
+ openGraph={{
+ type: 'website',
+ url: 'https://supabase.io/',
+ site_name: 'Supabase',
+ images: [
+ {
+ url: `${basePath}/images/og/og-image.jpg`,
+ width: 800,
+ height: 600,
+ alt: 'Og Image Alt',
+ },
+ ],
+ }}
+ twitter={{
+ handle: '@supabase_io',
+ site: '@supabase_io',
+ cardType: 'summary_large_image',
+ }}
+ />
+ <Component {...pageProps} />
+ </>
+ )
}
diff --git a/www/pages/blog/[slug].tsx b/www/pages/blog/[slug].tsx
index a4d7ca04231..ca46a4f1aad 100644
--- a/www/pages/blog/[slug].tsx
+++ b/www/pages/blog/[slug].tsx
@@ -1,5 +1,6 @@
// file: pages/blog/[slug].js
import React from 'react'
+import { useRouter } from 'next/router'
import DefaultLayout from '~/components/Layouts/Default'
import { NextSeo } from 'next-seo'
@@ -11,7 +12,7 @@ import matter from 'gray-matter'
import renderToString from 'next-mdx-remote/render-to-string'
import hydrate from 'next-mdx-remote/hydrate'
-import { IconFile, IconLink, Space, Typography, Badge } from '@supabase/ui'
+import { IconFile, Space, Typography, Badge } from '@supabase/ui'
import CodeBlock from '~/components/CodeBlock/CodeBlock'
import blogStyles from './[slug].module.css'
@@ -32,6 +33,8 @@ function BlogPostPage(props: any) {
const author = props.blog.author ? authors[props.blog.author] : authors['supabase']
const content = hydrate(props.blog.content, { components })
+ const { basePath } = useRouter()
+
return (
<>
<NextSeo
@@ -39,7 +42,7 @@ function BlogPostPage(props: any) {
openGraph={{
title: props.blog.title,
description: 'Description of open graph article',
- url: `https://supabase.io/blog/${props.blog.slug}`,
+ url: `${basePath}/blog/${props.blog.slug}`,
type: 'article',
article: {
//
@@ -56,7 +59,7 @@ function BlogPostPage(props: any) {
},
images: [
{
- url: `https://supabase.io/new/images/blog/${
+ url: `${basePath}/images/blog/${
props.blog.thumb ? props.blog.thumb : props.blog.image
}`,
},
diff --git a/www/pages/index.tsx b/www/pages/index.tsx
index 4e0ec308def..c7a8b2421f0 100644
--- a/www/pages/index.tsx
+++ b/www/pages/index.tsx
@@ -1,6 +1,3 @@
-import Head from 'next/head'
-import { APP_NAME, DESCRIPTION } from 'lib/constants'
-
import Container from 'components/Container'
import Layout from '~/components/Layouts/Default'
import Hero from 'components/Hero'
@@ -13,20 +10,10 @@ import CTABanner from 'components/CTABanner/index'
type Props = {}
-const site_title = `The Open Source Firebase Alternative | ${APP_NAME}`
-
const Index = ({}: Props) => {
return (
<>
<Layout>
- <Head>
- <title>
- {DESCRIPTION} | {site_title}
- </title>
- <meta name="og:title" property="og:title" content={site_title} />
- <meta name="twitter:site" content={site_title} />
- <meta name="twitter:text:title" content={site_title} />
- </Head>
<Container>
<Hero />
<Features />