1
0
mirror of https://github.com/XFox111/my-website.git synced 2026-04-22 07:28:01 +03:00

fix: DOMAIN_NAME variable partially baked in on build time

This commit is contained in:
2024-08-21 12:08:54 +00:00
parent 15b69d7e42
commit a217d0a96a
4 changed files with 53 additions and 43 deletions
+35 -31
View File
@@ -1,7 +1,8 @@
import Package from "@/../package.json";
import { Metadata } from "next"; import { Metadata } from "next";
import { unstable_noStore } from "next/cache";
import bio from "./bio"; import bio from "./bio";
import socials from "./socials"; import socials from "./socials";
import Package from "@/../package.json";
export const canonicalName: URL = new URL(`https://${process.env.DOMAIN_NAME}`); export const canonicalName: URL = new URL(`https://${process.env.DOMAIN_NAME}`);
const baseTitle: string = "Eugene Fox - Software developer"; const baseTitle: string = "Eugene Fox - Software developer";
@@ -12,37 +13,40 @@ const keywords: string[] = ["Eugene Fox", "software developer", ".net", "react",
export const getTitle = (pageTitle: string, customBase?: string): string => export const getTitle = (pageTitle: string, customBase?: string): string =>
pageTitle + " - " + (customBase ?? baseTitle); pageTitle + " - " + (customBase ?? baseTitle);
export const metadata: Metadata = export async function generateMetadata(): Promise<Metadata>
{ {
title: baseTitle, unstable_noStore();
description: bio[0], return {
metadataBase: canonicalName,
openGraph:
{
title: baseTitle, title: baseTitle,
description: bio[0], description: bio[0],
type: "profile", metadataBase: canonicalName,
firstName: Package.author.name.split(" ")[0], openGraph:
lastName: Package.author.name.split(" ")[1],
gender,
username: socials["Twitter"].username,
siteName: canonicalName.hostname,
locale: "en_US"
},
twitter:
{
site: socials["Twitter"].username,
card: "summary_large_image"
},
alternates:
{
canonical: canonicalName.href
},
authors: [
{ {
name: Package.author.name, title: baseTitle,
url: socials["LinkedIn"].href description: bio[0],
} type: "profile",
], firstName: Package.author.name.split(" ")[0],
keywords lastName: Package.author.name.split(" ")[1],
}; gender,
username: socials["Twitter"].username,
siteName: canonicalName.hostname,
locale: "en_US"
},
twitter:
{
site: socials["Twitter"].username,
card: "summary_large_image"
},
alternates:
{
canonical: canonicalName.href
},
authors: [
{
name: Package.author.name,
url: socials["LinkedIn"].href
}
],
keywords
};
}
+8 -4
View File
@@ -6,14 +6,18 @@ import ThirdPartyAttribution from "@/_data/ThirdPartyAttributiont";
import { analyticsEnabled } from "@/_utils/analytics/server"; import { analyticsEnabled } from "@/_utils/analytics/server";
import { ArrowLeft24Regular, ArrowRight24Regular } from "@fluentui/react-icons"; import { ArrowLeft24Regular, ArrowRight24Regular } from "@fluentui/react-icons";
import { Metadata } from "next"; import { Metadata } from "next";
import { unstable_noStore } from "next/cache";
import React from "react"; import React from "react";
import cls from "./page.module.scss"; import cls from "./page.module.scss";
export const metadata: Metadata = export async function generateMetadata(): Promise<Metadata>
{ {
title: getTitle("Attributions & information", canonicalName.hostname), unstable_noStore();
robots: "noindex" return {
}; title: getTitle("Attributions & information", canonicalName.hostname),
robots: "noindex"
};
}
const AttributionPage: React.FC = () => ( const AttributionPage: React.FC = () => (
<main className={ cls.page }> <main className={ cls.page }>
+2 -4
View File
@@ -1,5 +1,5 @@
import { metadata as myMetadata } from "@/_data/metadata"; export { generateMetadata } from "@/_data/metadata";
import type { Metadata, Viewport } from "next"; import type { Viewport } from "next";
import Script from "next/script"; import Script from "next/script";
import { PropsWithChildren } from "react"; import { PropsWithChildren } from "react";
import CookieBanner from "./_components/CookieBanner"; import CookieBanner from "./_components/CookieBanner";
@@ -19,8 +19,6 @@ export const viewport: Viewport =
colorScheme: "light dark" colorScheme: "light dark"
}; };
export const metadata: Metadata = myMetadata;
export default function RootLayout(props: PropsWithChildren) export default function RootLayout(props: PropsWithChildren)
{ {
return ( return (
+8 -4
View File
@@ -1,6 +1,7 @@
import { textCorrection } from "@/_assets/decorations"; import { textCorrection } from "@/_assets/decorations";
import { Home24Regular } from "@fluentui/react-icons"; import { Home24Regular } from "@fluentui/react-icons";
import { Metadata } from "next"; import { Metadata } from "next";
import { unstable_noStore } from "next/cache";
import Image from "next/image"; import Image from "next/image";
import React from "react"; import React from "react";
import { notFoundImage } from "./_assets/illustrations"; import { notFoundImage } from "./_assets/illustrations";
@@ -8,11 +9,14 @@ import Button from "./_components/Button";
import { canonicalName, getTitle } from "./_data/metadata"; import { canonicalName, getTitle } from "./_data/metadata";
import cls from "./not-found.module.scss"; import cls from "./not-found.module.scss";
export const metadata: Metadata = export async function generateMetadata(): Promise<Metadata>
{ {
title: getTitle("Page not found", canonicalName.hostname), unstable_noStore();
robots: "noindex" return {
}; title: getTitle("Page not found", canonicalName.hostname),
robots: "noindex"
};
}
// [SPECIAL] // [SPECIAL]