feat: better metadata, robots, and sitemap; simplify layout w/ AnimatedTitle and I18nProvider components

This commit is contained in:
Aidan 2025-08-04 02:27:38 -04:00
parent a37938e8c7
commit 5dc930bcbb
5 changed files with 136 additions and 57 deletions

View file

@ -1,41 +1,37 @@
"use client"
import React, { useEffect } from 'react'
import React from 'react'
import { Metadata } from 'next'
import Head from 'next/head'
import './globals.css'
import { GeistSans } from 'geist/font/sans'
import '../i18n'
import AnimatedTitle from '../components/AnimatedTitle'
import I18nProvider from '../components/I18nProvider'
export const metadata: Metadata = {
description: "The Internet home of Aidan. Come on in!",
openGraph: {
type: "website",
url: "https://aidxn.cc",
title: "aidxn.cc",
description: "The Internet home of Aidan. Come on in!",
siteName: "aidxn.cc",
images: [
{
url: "https://aidxn.cc/android-icon-192x192.png",
width: 192,
height: 192,
},
],
},
}
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
useEffect(() => {
const title = 'aidxn.cc';
let index = 1;
let forward = true;
const interval = setInterval(() => {
document.title = title.substring(0, index);
if (forward) {
index++;
if (index > title.length) {
forward = false;
index = title.length - 1;
}
} else {
index--;
if (index < 1) {
forward = true;
index = 1;
}
}
}, 500);
return () => clearInterval(interval);
}, []);
return (
<html lang="en" className="dark">
<head>
<Head>
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png" />
@ -55,14 +51,15 @@ export default function RootLayout({
<meta name="theme-color" content="#ffffff" />
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="The Internet home of Aidan. Come on in!" />
<meta name="keywords" content="blog, android, developer" />
<meta name="robots" content="index, follow" />
<meta name="language" content="English" />
<meta name="author" content="aidxn.cc" />
</head>
</Head>
<body className={`${GeistSans.className} bg-gray-900 text-gray-100`}>
<AnimatedTitle />
<I18nProvider>
{children}
</I18nProvider>
</body>
</html>
);

9
app/robots.ts Normal file
View file

@ -0,0 +1,9 @@
import type { MetadataRoute } from 'next'
export const robots: MetadataRoute.Robots = {
rules: {
userAgent: '*',
allow: '/',
},
sitemap: 'https://aidxn.cc/sitemap.xml',
}

36
app/sitemap.ts Normal file
View file

@ -0,0 +1,36 @@
import type { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{
url: 'https://aidxn.cc',
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 1.0,
},
{
url: 'https://aidxn.cc/about',
lastModified: new Date(),
changeFrequency: 'weekly',
priority: 0.8,
},
{
url: 'https://aidxn.cc/contact',
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: 'https://aidxn.cc/domains',
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.8,
},
{
url: 'https://aidxn.cc/manifesto',
lastModified: new Date(),
changeFrequency: 'yearly',
priority: 0.7,
},
]
}

View file

@ -0,0 +1,29 @@
"use client"
import { useEffect } from "react";
export default function AnimatedTitle() {
useEffect(() => {
const title = 'aidxn.cc';
let index = 1;
let forward = true;
const interval = setInterval(() => {
document.title = title.substring(0, index);
if (forward) {
index++;
if (index > title.length) {
forward = false;
index = title.length - 1;
}
} else {
index--;
if (index < 1) {
forward = true;
index = 1;
}
}
}, 500);
return () => clearInterval(interval);
}, []);
return null;
}

View file

@ -0,0 +1,8 @@
"use client";
import { ReactNode } from "react";
import "../i18n";
export default function I18nProvider({ children }: { children: ReactNode }) {
return <>{children}</>;
}