Next SEO Meta Component

    0

    0

    Psypher1

    SEO with Next.js

    NextSeo allows you to append metadata to your routes, which then runs through Meta() to generate the appropriate HTML.

    In this example, we are adding a title and description to the HTML for our route. We are also adding some meta information about our website, like the title and description for our Open Graph tags. We are also setting the open graph property for our route.

    Library: next

    import { NextSeo } from "next-seo";
    import { useRouter } from "next/router";
    
    import { NextSeo } from "next-seo";
    import { useRouter } from "next/router";
    
    export default function Meta({ pageMeta }) {
      const router = useRouter();
      const meta = {
        title: "The Language Hub",
        description: "Getting you to what's important as easily as possible",
        // canonical: `http://localhost:3000${router.asPath}`,
        ...pageMeta,
      };
      const SEO = {
        title: `TLH | ${meta.title}`,
        description: meta.description,
    
        openGraph: {
          title: meta.title,
          description: meta.description,
        },
      };
      return <NextSeo {...SEO} />;
    }
    
    
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    Legal
    • Security
    • Privacy Policy
    • Code Privacy
    • Terms of Service
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.