feat: add schema.org metadata

This commit is contained in:
Riccardo
2024-08-31 19:40:32 +02:00
parent 8d23e1017f
commit 16d35b60b1
5 changed files with 92 additions and 28 deletions

View File

@@ -1,4 +1,5 @@
'use client';
import { Button } from '@components/Button';
import { CardDescription } from '@components/Card';
import CustomCard from '@components/CustomCard';
@@ -6,6 +7,7 @@ import ErrorMessage from '@components/ErrorMessage';
import { FormControl } from '@components/form/FormControl';
import { FormMessage } from '@components/form/FormMessage';
import { Input } from '@components/Input';
import Schema from '@components/SchemaOrg';
import { FormField } from '@contexts/FormField/FormFieldProvider';
import { FormItem } from '@contexts/FormItem/FormItemProvider';
import { zodResolver } from '@hookform/resolvers/zod';
@@ -22,6 +24,14 @@ export default function Home() {
const [message, setMessage] = useState('');
const [error, setError] = useState(false);
const schema = {
'@context': 'https://schema.org',
'@type': 'WebSite',
name: 'HackerNews Newsletter',
title: 'Home',
url: process.env.HOME_URL
};
const form = useForm<SubscribeFormType>({
resolver: zodResolver(SubscribeFormSchema),
defaultValues: {
@@ -58,7 +68,7 @@ export default function Home() {
}
}
function render() {
const renderContent = () => {
if (error) {
return ErrorMessage();
}
@@ -105,14 +115,17 @@ export default function Home() {
</p>
</div>
);
}
};
return (
<CustomCard
className='max-90vw w-96'
title='Interested in keeping up with the latest from the tech world? 👩‍💻'
description='Subscribe to our newsletter! The top stories from Hackernews for you. Once a day. Every day.'
content={render()}
/>
<>
<Schema schema={schema} />
<CustomCard
className='max-90vw w-96'
title='Interested in keeping up with the latest from the tech world? 👩‍💻'
description='Subscribe to our newsletter! The top stories from Hackernews for you. Once a day. Every day.'
content={renderContent()}
/>
</>
);
}