File tree Expand file tree Collapse file tree 7 files changed +61
-5
lines changed Expand file tree Collapse file tree 7 files changed +61
-5
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,14 @@ import { notFound } from "next/navigation";
4
4
import { format } from "date-fns" ;
5
5
import MDX from "@/components/MDX" ;
6
6
import { H2 } from "@/packages/ui" ;
7
+ import { Metadata } from "next" ;
7
8
8
- function getDocParams ( slug : string ) {
9
+ interface IProps {
10
+ params : { slug : string [ ] } ;
11
+ }
12
+
13
+ function getDocParams ( { params } : IProps ) {
14
+ const slug = `/docs${ params . slug ? `/${ params . slug . join ( "/" ) } ` : "" } ` ;
9
15
const doc = allDocs . find ( ( doc ) => doc . url === slug ) ;
10
16
11
17
if ( ! doc ) {
@@ -15,9 +21,23 @@ function getDocParams(slug: string) {
15
21
return doc ;
16
22
}
17
23
18
- export default function page ( { params } : { params : { slug : string [ ] } } ) {
19
- const slug = `/docs${ params . slug ? `/${ params . slug . join ( "/" ) } ` : "" } ` ;
20
- const doc = getDocParams ( slug ) ;
24
+ export async function generateMetadata ( { params } : IProps ) : Promise < Metadata > {
25
+ const doc = getDocParams ( { params } ) ;
26
+
27
+ if ( ! doc ) {
28
+ return {
29
+ title : "Not Found | Retro UI" ,
30
+ } ;
31
+ }
32
+
33
+ return {
34
+ title : `${ doc . title } | Retro UI` ,
35
+ description : doc . description
36
+ } ;
37
+ }
38
+
39
+ export default function page ( { params } : IProps ) {
40
+ const doc = getDocParams ( { params } ) ;
21
41
22
42
if ( ! doc ) {
23
43
return notFound ( ) ;
Original file line number Diff line number Diff line change 1
- import { JoinNewsletter } from "@/components" ;
2
1
import {
3
2
Accordion ,
4
3
Avatar ,
Original file line number Diff line number Diff line change 1
1
import TopNav from "@/components/TopNav" ;
2
2
import "./global.css" ;
3
3
import { Archivo_Black , Share_Tech , Share_Tech_Mono } from "next/font/google" ;
4
+ import { Metadata } from "next" ;
4
5
5
6
const archivoBlack = Archivo_Black ( {
6
7
subsets : [ "latin" ] ,
@@ -20,6 +21,14 @@ const shareTechMono = Share_Tech_Mono({
20
21
variable : "--font-mono" ,
21
22
} ) ;
22
23
24
+ export const metadata : Metadata = {
25
+ title : "Retro Styled Tailwind UI Library | Retro UI" ,
26
+ description : "RetroUI - Retro styled TailwindCSS component library for modern web apps." ,
27
+ openGraph : {
28
+ images : [ '/banner.png' ]
29
+ }
30
+ } ;
31
+
23
32
export default function RootLayout ( {
24
33
children,
25
34
} : {
Original file line number Diff line number Diff line change
1
+ import type { MetadataRoute } from 'next'
2
+
3
+ export default function robots ( ) : MetadataRoute . Robots {
4
+ return {
5
+ rules : {
6
+ userAgent : '*' ,
7
+ allow : '/' ,
8
+ } ,
9
+ sitemap : 'https://retroui.dev/sitemap.xml' ,
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ import { allDocs } from "@/.contentlayer/generated" ;
2
+ import type { MetadataRoute } from "next" ;
3
+
4
+ export default function sitemap ( ) : MetadataRoute . Sitemap {
5
+ return [
6
+ {
7
+ url : "https://retroui.dev" ,
8
+ lastModified : new Date ( ) ,
9
+ changeFrequency : "yearly" ,
10
+ priority : 1 ,
11
+ } ,
12
+ ...allDocs . map ( ( doc ) => ( {
13
+ url : `https://retroui.dev${ doc . url } ` ,
14
+ lastModified : doc . lastUpdated ,
15
+ } ) ) ,
16
+ ] ;
17
+ }
You can’t perform that action at this time.
0 commit comments