Skip to content

Commit

Permalink
Set HTML lang
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbithell committed Jun 9, 2024
1 parent a33e0d2 commit ea9f524
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/components/SEO.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
import React from "react"
import { useSiteMetadata } from "../hooks/use-site-metadata"
import React from "react";
import { useSiteMetadata } from "../hooks/use-site-metadata";

export const SEO = ({ title, description, pathname, children }: { title?: string, description?: string, pathname?: string, children?: React.ReactNode }) => {
const { title: defaultTitle, description: defaultDescription, siteUrl } = useSiteMetadata()
export const SEO = ({
title,
description,
pathname,
children,
}: {
title?: string;
description?: string;
pathname?: string;
children?: React.ReactNode;
}) => {
const {
title: defaultTitle,
description: defaultDescription,
siteUrl,
} = useSiteMetadata();

const seo = {
title: (title ? title + " | " : "") + defaultTitle,
description: description || defaultDescription,
url: `${siteUrl}${pathname || ``}`,
}
};

return (
<>
<html lang="en" />
<title>{seo.title}</title>
<meta charSet="utf-8" />
<meta name="description" content={seo.description} />
Expand All @@ -22,5 +37,5 @@ export const SEO = ({ title, description, pathname, children }: { title?: string
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
{children}
</>
)
}
);
};

0 comments on commit ea9f524

Please sign in to comment.