Skip to content

Commit

Permalink
refactor: remove hardcoded site url for metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
marthendalnunes committed Apr 5, 2024
1 parent adac074 commit 7c06506
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 19 deletions.
3 changes: 0 additions & 3 deletions apps/website/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Website URL
NEXT_PUBLIC_SITE_URL=

# Event Cache URL
NEXT_PUBLIC_API_EVENT_CACHE=

Expand Down
11 changes: 2 additions & 9 deletions apps/website/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,23 @@ import "@/styles/app.css"
import "@/styles/globals.css"

import { ReactNode } from "react"
import { env } from "@/env.mjs"
import { type Metadata } from "next"

import { siteConfig } from "@/config/site"
import { fontSans } from "@/lib/fonts"
import { cn } from "@/lib/utils"
import RootProvider from "@/components/providers/root-provider"

const url = env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"

export const metadata = {
metadataBase: new URL(url),
export const metadata: Metadata = {
title: `${siteConfig.name} - ${siteConfig.description}`,
description: siteConfig.description,
manifest: "/manifest.json",
icons: {
icon: "/favicon.ico",
},
visualViewport: {
themeColor: "#feefc4",
},
openGraph: {
title: siteConfig.name,
description: siteConfig.description,
url: url?.toString(),
siteName: siteConfig.name,
type: "website",
},
Expand Down
2 changes: 0 additions & 2 deletions apps/website/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { z } from "zod"

export const env = createEnv({
client: {
NEXT_PUBLIC_SITE_URL: z.string().url().optional(),
NEXT_PUBLIC_API_EVENT_CACHE: z.string().url(),
NEXT_PUBLIC_MAINNET_RPC: z.string().url().optional(),
NEXT_PUBLIC_BASE_RPC: z.string().url().optional(),
Expand All @@ -15,7 +14,6 @@ export const env = createEnv({
NEXT_PUBLIC_ALCHEMY_API_KEY: z.string().min(1),
},
runtimeEnv: {
NEXT_PUBLIC_SITE_URL: process.env.NEXT_PUBLIC_SITE_URL,
NEXT_PUBLIC_API_EVENT_CACHE: process.env.NEXT_PUBLIC_API_EVENT_CACHE,
NEXT_PUBLIC_MAINNET_RPC: process.env.NEXT_PUBLIC_MAINNET_RPC,
NEXT_PUBLIC_BASE_RPC: process.env.NEXT_PUBLIC_BASE_RPC,
Expand Down
5 changes: 0 additions & 5 deletions apps/website/lib/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { env } from "@/env.mjs"
import { ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

Expand All @@ -15,10 +14,6 @@ export function formatDate(input: string | number): string {
})
}

export function absoluteUrl(path: string) {
return `${env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"}${path}`
}

export function trimFormattedBalance(
balance: string | undefined,
decimals = 4
Expand Down

0 comments on commit 7c06506

Please sign in to comment.