Skip to content

Commit

Permalink
Merge pull request #6 from codad5/website-dev
Browse files Browse the repository at this point in the history
Update page.tsx and layout.tsx for seo
  • Loading branch information
codad5 committed Jan 4, 2024
2 parents ed2ae9e + 490836c commit 5dfd617
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
38 changes: 37 additions & 1 deletion app/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Image from 'next/image'
import Header from '@/components/ui/header'
import Hero from '@/components/ui/hero'
import { getPostContent, getPostsAndMetadata } from '@/libs/posts';
import { getPostContent, getPostMetadata, getPostsAndMetadata } from '@/libs/posts';
import { postsType } from '@/libs/types';
import matter from 'gray-matter';
import { notFound } from 'next/navigation';
import Markdown from 'markdown-to-jsx';
import { Metadata } from 'next';


export const generateStaticParams = () => {
Expand All @@ -16,6 +17,41 @@ export const generateStaticParams = () => {
}))
}

export async function generateMetadata({ params, searchParams }: { params: { slug: string }, searchParams: any }): Promise<Metadata> {
const { slug } = params;
const postContents = getPostMetadata(slug, 'static-pages')
if(!postContents) return {};
const { title, date, description, tags, image } = postContents
return {
title,
description : `Google Task Desktop Client - ${description}`,
keywords: tags ?? ['google', 'task', 'desktop', 'client', 'electron', 'react', 'typescript', 'nextjs', 'codad5'],
authors: [{ name: 'Chibueze Michael Aniezeofor', url: 'https://codad5.me' }],
creator: 'Chibueze Michael Aniezeofor',
publisher: 'Chibueze Michael Aniezeofor',
alternates: {},
formatDetection: {
email: true,
address: true,
telephone: true,
},
openGraph: {
title,
description,
url: `https://google-task.codad5.me//${slug}`,
type: 'website',
images: [
{
url: image ?? 'https://google-task.codad5.me/google-task.png',
width: 800,
height: 600,
alt: title,
},
],
},
}
}


export default function StaticPage({ params }: { params: { slug: string } }) {
const { slug } = params;
Expand Down
25 changes: 24 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,30 @@ const inter = Inter({ subsets: ['latin'] })

export const metadata: Metadata = {
title: 'Google Tasks',
description: 'Google Tasks Desktop App for Windows, Mac & Linux',
description: 'Google Tasks Desktop App for Windows, Mac & Linux built using React & Rust (Tauri)',
keywords: ['google', 'task', 'desktop', 'client', 'electron', 'react', 'typescript', 'nextjs', 'codad5', 'windows', 'mac', 'linux', 'tauri', 'lightweight', 'fast', 'cross-platform'],
authors: [{ name: 'Chibueze Michael Aniezeofor', url: 'https://codad5.me' }],
creator: 'Chibueze Michael Aniezeofor',
publisher: 'Chibueze Michael Aniezeofor',
alternates: {},
formatDetection: {
email: true,
address: true,
telephone: true,
},
robots: {
index: true,
follow: true,
nocache: false,
googleBot: {
index: true,
follow: true,
noimageindex: false,
'max-video-preview': -1,
'max-image-preview': 'standard',
'max-snippet': -1,
},
},
}

export default function RootLayout({
Expand Down

0 comments on commit 5dfd617

Please sign in to comment.