Skip to content

Commit

Permalink
website SEO enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
rstaib committed Jan 1, 2023
1 parent f74d400 commit 159077b
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 96 deletions.
21 changes: 19 additions & 2 deletions website/gatsby-config.js
@@ -1,11 +1,14 @@
/** @type import('gatsby').GatsbyConfig */

const SITE_URL = `https://chillicream.com`;

module.exports = {
siteMetadata: {
title: `ChilliCream GraphQL Platform`,
description: `We're building the ultimate GraphQL platform`,
description: `We help companies and developers to build next level APIs with GraphQL by providing them the right tooling.`,
author: `Chilli_Cream`,
company: "ChilliCream",
siteUrl: `https://chillicream.com`,
siteUrl: SITE_URL,
repositoryUrl: `https://github.com/ChilliCream/hotchocolate`,
tools: {
bcp: `https://eat.bananacakepop.com`,
Expand Down Expand Up @@ -173,6 +176,20 @@ module.exports = {
},
},
},
{
resolve: `gatsby-plugin-robots-txt`,
options: {
host: SITE_URL,
sitemap: `${SITE_URL}/sitemap-index.xml`,
policy: [
{
userAgent: `*`,
allow: `/`,
disallow: [`/docs/hotchocolate/v10/`, `/docs/hotchocolate/v11/`],
},
],
},
},
{
resolve: `gatsby-plugin-feed`,
options: {
Expand Down
175 changes: 96 additions & 79 deletions website/gatsby-node.js
Expand Up @@ -60,104 +60,86 @@ exports.createPages = async ({ actions, graphql, reporter }) => {

createDocPages(createPage, result.data.docs, products);

createRedirect({
fromPath: "/docs/",
toPath: "/docs/hotchocolate/",
redirectInBrowser: true,
isPermanent: true,
});
// Docs
createPermanentRedirectWithAndWithoutEndSlash(
"/docs",
"/docs/hotchocolate",
createRedirect
);

const hotchocolate = products.find((p) => p.path === "hotchocolate");

if (hotchocolate) {
createHotChocolateRedirects(hotchocolate, createRedirect);
}

createRedirect({
fromPath: "/docs/marshmallowpie/",
toPath: "/docs/hotchocolate/",
redirectInBrowser: true,
isPermanent: true,
});
// Hot Chocolate
createPermanentRedirectWithAndWithoutEndSlash(
"/docs/hotchocolate/get-started",
"/docs/hotchocolate/get-started-with-graphql-in-net-core",
createRedirect
);
createPermanentRedirectWithAndWithoutEndSlash(
"/docs/hotchocolate/v12/get-started",
"/docs/hotchocolate/v12/get-started-with-graphql-in-net-core",
createRedirect
);
createPermanentRedirectWithAndWithoutEndSlash(
"/docs/hotchocolate/v13/get-started",
"/docs/hotchocolate/v13/get-started-with-graphql-in-net-core",
createRedirect
);

createRedirect({
fromPath: "/blog/2019/03/18/entity-framework",
toPath: "/blog/2020/03/18/entity-framework",
redirectInBrowser: true,
isPermanent: true,
});
// Marshmallow Pie
createPermanentRedirectWithAndWithoutEndSlash(
"/docs/marshmallowpie",
"/docs/hotchocolate",
createRedirect
);

// Blog
createPermanentRedirectWithAndWithoutEndSlash(
"/blog/2019/03/18/entity-framework",
"/blog/2020/03/18/entity-framework",
createRedirect
);

// Banana Cake Pop
createRedirect({
fromPath: "/banana-cake-pop",
toPath: "/products/bananacakepop",
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: "/banana-cake-pop/",
toPath: "/products/bananacakepop",
redirectInBrowser: true,
isPermanent: true,
});
createPermanentRedirectWithAndWithoutEndSlash(
"/banana-cake-pop",
"/products/bananacakepop",
createRedirect
);

// Products
createRedirect({
fromPath: "/products",
toPath: "/",
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: "/products/",
toPath: "/",
redirectInBrowser: true,
isPermanent: true,
});
createPermanentRedirectWithAndWithoutEndSlash(
"/products",
"/",
createRedirect
);

// Company
createRedirect({
fromPath: "/company",
toPath: "/",
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: "/company/",
toPath: "/",
redirectInBrowser: true,
isPermanent: true,
});
createPermanentRedirectWithAndWithoutEndSlash(
"/company",
"/",
createRedirect
);

// Services
createRedirect({
fromPath: "/services",
toPath: "/services/support",
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: "/services/",
toPath: "/services/support",
redirectInBrowser: true,
isPermanent: true,
});
createPermanentRedirectWithAndWithoutEndSlash(
"/services",
"/services/support",
createRedirect
);

// Support
createRedirect({
fromPath: "/support",
toPath: "/services/support",
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: "/support/",
toPath: "/services/support",
redirectInBrowser: true,
isPermanent: true,
});
createPermanentRedirectWithAndWithoutEndSlash(
"/support",
"/services/support",
createRedirect
);

// images
// Images
createRedirect({
fromPath: "/img/projects/greendonut-banner.svg",
toPath: "/resources/greendonut-banner.svg",
Expand Down Expand Up @@ -557,3 +539,38 @@ function getGitLog(filepath) {

return git().log(logOptions);
}

function createPermanentRedirectWithAndWithoutEndSlash(
fromPath,
toPath,
createRedirect
) {
createRedirect({
fromPath: ensurePathEndsWithoutSlash(fromPath),
toPath: ensurePathEndsWithoutSlash(toPath),
redirectInBrowser: true,
isPermanent: true,
});
createRedirect({
fromPath: ensurePathEndsWithSlash(fromPath),
toPath: ensurePathEndsWithoutSlash(toPath),
redirectInBrowser: true,
isPermanent: true,
});
}

function ensurePathEndsWithSlash(path) {
if (path.length > 1 && path[path.length - 1] === "/") {
return path;
}

return path + "/";
}

function ensurePathEndsWithoutSlash(path) {
if (path.length > 1 && path[path.length - 1] === "/") {
return path.substring(0, path.length - 1);
}

return path;
}
3 changes: 3 additions & 0 deletions website/src/components/doc-page/doc-page.tsx
Expand Up @@ -57,6 +57,7 @@ export const DocPage: FC<DocPageProps> = ({ data, originPath }) => {
const { fields, frontmatter, body } = data.file!.childMdx!;
const slug = fields!.slug!;
const title = frontmatter!.title!;
const description = frontmatter!.description;

const product = useProductInformation(slug, data.productsConfig?.products);

Expand Down Expand Up @@ -119,6 +120,7 @@ export const DocPage: FC<DocPageProps> = ({ data, originPath }) => {
<ArticleTitle>{title}</ArticleTitle>
</ArticleHeader>
<ArticleContent>
{description && <p>{description}</p>}
<MDXRenderer>{body}</MDXRenderer>
<ArticleContentFooter
lastUpdated={fields!.lastUpdated!}
Expand Down Expand Up @@ -154,6 +156,7 @@ export const DocPageGraphQLFragment = graphql`
}
frontmatter {
title
description
}
body
...ArticleSections
Expand Down
6 changes: 3 additions & 3 deletions website/src/docs/docs.json
Expand Up @@ -45,7 +45,7 @@
{
"path": "hotchocolate",
"title": "Hot Chocolate",
"metaDescription": "Hot Chocolate is the most efficient, feature-rich, open-source GraphQL server in the .NET ecosystem, that helps developer to build powerful APIs.",
"metaDescription": "Hot Chocolate is the most efficient, feature-rich, open-source GraphQL server in the .NET ecosystem, that helps developers to build powerful APIs.",
"description": "Build your own thin GraphQL API layer on top of any resource.",
"latestStableVersion": "v12",
"versions": [
Expand All @@ -58,7 +58,7 @@
"title": "Introduction"
},
{
"path": "get-started",
"path": "get-started-with-graphql-in-net-core",
"title": "Get Started"
},
{
Expand Down Expand Up @@ -392,7 +392,7 @@
"title": "Introduction"
},
{
"path": "get-started",
"path": "get-started-with-graphql-in-net-core",
"title": "Get Started"
},
{
Expand Down
2 changes: 1 addition & 1 deletion website/src/docs/hotchocolate/v11/index.md
Expand Up @@ -11,7 +11,7 @@ Hot Chocolate takes the complexity away from building a fully-fledged GraphQL se
You can use Hot Chocolate Server as:

- Stand-alone [ASP.NET Core](https://learn.microsoft.com/aspnet/core) GraphQL Server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [Amazon Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [AWS Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- [GraphQL Gateway](/docs/hotchocolate/v11/distributed-schema) for a federated data graph that pulls all your data sources together to create the one source of truth.

Hot Chocolate is very easy to set up and takes the clutter away from writing GraphQL schemas. We update Hot Chocolate continuously and implement new spec features as they hit draft status. This lets you pick up new GraphQL features incrementally to open up new development opportunities for your ideas.
Expand Down
@@ -1,12 +1,11 @@
---
title: "Get started with Hot Chocolate"
title: "Get started with GraphQL in .NET Core"
description: "In this tutorial, we will walk you through the basics of creating a GraphQL .NET server with Hot Chocolate."
---

import { ApiChoiceTabs } from "../../../components/mdx/api-choice-tabs"
import { InputChoiceTabs } from "../../../components/mdx/input-choice-tabs"

In this tutorial, we will walk you through the basics of creating a GraphQL server with Hot Chocolate.

<iframe width="560" height="315"
src="https://www.youtube.com/embed/qrh97hToWpM"frameborder="0"
allowfullscreen></iframe>
Expand Down
4 changes: 2 additions & 2 deletions website/src/docs/hotchocolate/v12/index.md
Expand Up @@ -11,11 +11,11 @@ Hot Chocolate takes the complexity away from building a fully-fledged GraphQL se
You can use Hot Chocolate Server as:

- Stand-alone [ASP.NET Core](https://learn.microsoft.com/aspnet/core) GraphQL Server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [Amazon Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [AWS Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- [GraphQL Gateway](/docs/hotchocolate/v12/distributed-schema) for a federated data graph that pulls all your data sources together to create the one source of truth.

Hot Chocolate is very easy to set up and takes the clutter away from writing GraphQL schemas. We update Hot Chocolate continuously and implement new spec features as they hit draft status. This lets you pick up new GraphQL features incrementally to open up new development opportunities for your ideas.

Let's [get started](/docs/hotchocolate/v12/get-started) with Hot Chocolate!
Let's [get started](/docs/hotchocolate/v12/get-started-with-graphql-in-net-core) with Hot Chocolate!

Join us on [YouTube](https://youtube.chillicream.com) for Hot Chocolate deep dives.
@@ -1,12 +1,11 @@
---
title: "Get started with Hot Chocolate"
title: "Get started with GraphQL in .NET Core"
description: "In this tutorial, we will walk you through the basics of creating a GraphQL .NET server with Hot Chocolate."
---

import { ApiChoiceTabs } from "../../../components/mdx/api-choice-tabs"
import { InputChoiceTabs } from "../../../components/mdx/input-choice-tabs"

In this tutorial, we will walk you through the basics of creating a GraphQL server with Hot Chocolate.

<iframe width="560" height="315"
src="https://www.youtube.com/embed/qrh97hToWpM"frameborder="0"
allowfullscreen></iframe>
Expand Down
4 changes: 2 additions & 2 deletions website/src/docs/hotchocolate/v13/index.md
Expand Up @@ -11,11 +11,11 @@ Hot Chocolate takes the complexity away from building a fully-fledged GraphQL se
You can use Hot Chocolate Server as:

- Stand-alone [ASP.NET Core](https://learn.microsoft.com/aspnet/core) GraphQL Server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [Amazon Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- Serverless [Azure Function](https://azure.microsoft.com/products/functions) or [AWS Lambda](https://aws.amazon.com/lambda) that serves up a GraphQL server.
- [GraphQL Gateway](/docs/hotchocolate/v13/distributed-schema) for a federated data graph that pulls all your data sources together to create the one source of truth.

Hot Chocolate is very easy to set up and takes the clutter away from writing GraphQL schemas. We update Hot Chocolate continuously and implement new spec features as they hit draft status. This lets you pick up new GraphQL features incrementally to open up new development opportunities for your ideas.

Let's [get started](/docs/hotchocolate/v13/get-started) with Hot Chocolate!
Let's [get started](/docs/hotchocolate/v13/get-started-with-graphql-in-net-core) with Hot Chocolate!

Join us on [YouTube](https://youtube.chillicream.com) for Hot Chocolate deep dives.
6 changes: 5 additions & 1 deletion website/src/templates/doc-page-template.tsx
Expand Up @@ -15,6 +15,7 @@ export interface DocPageTemplateProps {
const DocPageTemplate: FC<DocPageTemplateProps> = ({ data, pageContext }) => {
const childMdx = data.file!.childMdx!;
const documentTitle = data.file!.childMdx!.frontmatter!.title!;
const description = data.file!.childMdx!.frontmatter!.description;
const product = useProductInformation(
childMdx.fields!.slug!,
data.productsConfig?.products
Expand All @@ -32,7 +33,10 @@ const DocPageTemplate: FC<DocPageTemplateProps> = ({ data, pageContext }) => {

return (
<Layout>
<SEO title={title} description={product?.description || undefined} />
<SEO
title={title}
description={description || product?.description || undefined}
/>
{product && (
<>
<SrOnly className="product-name">{product.name}</SrOnly>
Expand Down

0 comments on commit 159077b

Please sign in to comment.