Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance seo #5617

Merged
merged 1 commit into from
Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions website/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
`gatsby-plugin-graphql-codegen`,
`gatsby-plugin-styled-components`,
`gatsby-plugin-react-helmet`,
`gatsby-plugin-robots-txt`,
`gatsby-plugin-tsconfig-paths`,
`gatsby-remark-reading-time`,
{
Expand Down
3 changes: 2 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@
"gatsby-plugin-react-helmet": "^4.6.0",
"gatsby-plugin-react-redux": "^1.1.0-0",
"gatsby-plugin-react-svg": "^3.0.1",
"gatsby-plugin-robots-txt": "^1.8.0",
"gatsby-plugin-sharp": "^3.6.0",
"gatsby-plugin-sitemap": "^4.2.0",
"gatsby-plugin-sitemap": "^6.3.1",
"gatsby-plugin-styled-components": "^4.6.0",
"gatsby-plugin-tsconfig-paths": "^1.0.5",
"gatsby-plugin-web-font-loader": "^1.0.4",
Expand Down
6 changes: 3 additions & 3 deletions website/src/components/layout/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ const ProductsNavItem: FC<ProductsNavItemProps> = ({ firstBlogPost }) => {

return (
<NavItemContainer {...navHandlers}>
<NavLink to="/products" {...linkHandlers}>
<NavLink to="/products" prefetch={false} {...linkHandlers}>
Products
<IconContainer size={10}>
<ArrowDownSvg />
Expand Down Expand Up @@ -504,7 +504,7 @@ const DeveloperNavItem: FC<DeveloperNavItemProps> = ({ products, tools }) => {

return (
<NavItemContainer {...navHandlers}>
<NavLink to="/docs" {...linkHandlers}>
<NavLink to="/docs" prefetch={false} {...linkHandlers}>
Developers
<IconContainer size={10}>
<ArrowDownSvg />
Expand Down Expand Up @@ -558,7 +558,7 @@ const ServicesNavItem: FC = () => {

return (
<NavItemContainer {...navHandlers}>
<NavLink to="/services" {...linkHandlers}>
<NavLink to="/services" prefetch={false} {...linkHandlers}>
Services
<IconContainer size={10}>
<ArrowDownSvg />
Expand Down
19 changes: 12 additions & 7 deletions website/src/components/misc/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,27 @@ import { GatsbyLinkProps, Link as GatsbyLink } from "gatsby";
import { OutboundLink } from "gatsby-plugin-google-analytics";
import React, { FC } from "react";

export const Link: FC<GatsbyLinkProps<unknown>> = ({
export const Link: FC<GatsbyLinkProps<unknown> & { prefetch?: false }> = ({
activeClassName,
partiallyActive,
to,
ref,
prefetch = true,
...rest
}) => {
const internal = /^\/(?!\/)/.test(to);

return internal ? (
<GatsbyLink
to={to}
activeClassName={activeClassName}
partiallyActive={partiallyActive}
{...rest}
/>
prefetch ? (
<GatsbyLink
to={to}
activeClassName={activeClassName}
partiallyActive={partiallyActive}
{...rest}
/>
) : (
<a href={to} {...rest} />
)
) : (
<OutboundLink
href={to}
Expand Down
31 changes: 27 additions & 4 deletions website/src/components/misc/seo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const SEO: FC<SEOProps> = ({
siteMetadata {
title
description
company
author
siteUrl
}
Expand All @@ -49,11 +50,14 @@ export const SEO: FC<SEOProps> = ({
`
);

const metaSiteUrl = site.siteMetadata.siteUrl;
const metaAuthor = `@${site.siteMetadata.author}`;
const metaCompany = site.siteMetadata.company;
const metaDescription = description || site.siteMetadata.description;
const metaImageUrl = `${site.siteMetadata.siteUrl}${
const metaImageUrl = `${metaSiteUrl}${
imageUrl ?? image?.childImageSharp!.gatsbyImageData!.images.fallback.src
}`;
const metaType = isArticle ? "article" : "website";

return (
<Helmet
Expand All @@ -69,7 +73,7 @@ export const SEO: FC<SEOProps> = ({
},
{
property: `og:url`,
content: site.siteMetadata.siteUrl,
content: metaSiteUrl,
},
{
property: `og:title`,
Expand All @@ -81,7 +85,7 @@ export const SEO: FC<SEOProps> = ({
},
{
property: `og:type`,
content: !!isArticle ? `article` : `website`,
content: metaType,
},
{
property: `og:image`,
Expand Down Expand Up @@ -109,7 +113,26 @@ export const SEO: FC<SEOProps> = ({
},
...meta!,
]}
/>
>
<script type="application/ld+json">
{JSON.stringify({
"@context": "https://schema.org/",
"@type": metaType,
"@id": metaSiteUrl,
headline: title,
description: metaDescription,
author: {
"@type": "Organization",
name: metaCompany,
contactPoint: {
"@type": "ContactPoint",
email: "mailto:contact@chillicream.com",
contactType: "Customer Support",
},
},
})}
</script>
</Helmet>
);
};

Expand Down
Loading