You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Replace NextSeo and DefaultSeo components with generateNextSeo and generateDefaultSeo functions for improved SEO tag generation in Next.js Pages Router. Update README and tests accordingly.
> **Important:** In Pages Router, you need to wrap the SEO components with Next.js's `<Head>` component to ensure the meta tags are properly rendered in the document head.
25
+
> **Important:** In Pages Router, you need to wrap the generated SEO tags with Next.js's `<Head>` component to ensure the meta tags are properly rendered in the document head.
26
26
27
-
### NextSeo Component
27
+
### generateNextSeo Function
28
28
29
29
Add SEO meta tags to individual pages:
30
30
31
31
```tsx
32
32
// pages/about.tsx
33
33
importHeadfrom"next/head";
34
-
import { NextSeo } from"next-seo/pages";
34
+
import { generateNextSeo } from"next-seo/pages";
35
35
36
36
exportdefaultfunction AboutPage() {
37
37
return (
38
38
<>
39
39
<Head>
40
-
<NextSeo
41
-
title="About Us"
42
-
description="Learn more about our company"
43
-
canonical="https://example.com/about"
44
-
openGraph={{
40
+
{generateNextSeo({
41
+
title: "About Us",
42
+
description: "Learn more about our company",
43
+
canonical: "https://example.com/about",
44
+
openGraph: {
45
45
url: "https://example.com/about",
46
46
title: "About Us",
47
47
description: "Learn more about our company",
@@ -53,8 +53,8 @@ export default function AboutPage() {
53
53
alt: "About Us",
54
54
},
55
55
],
56
-
}}
57
-
/>
56
+
},
57
+
})}
58
58
</Head>
59
59
<h1>About Us</h1>
60
60
{/* Page content */}
@@ -63,15 +63,15 @@ export default function AboutPage() {
0 commit comments