Skip to content

Commit

Permalink
docs: custom head and descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
samrith-s committed Jan 1, 2025
1 parent 15616ab commit dbae0d6
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 41 deletions.
9 changes: 5 additions & 4 deletions docs/astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import starlight from "@astrojs/starlight";

import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
import vercelStatic from "@astrojs/vercel/static";
import vercelStatic from "@astrojs/vercel";

import { defineConfig } from "astro/config";

import { meta } from "./meta.config";

const SITE = "https://genshi.samrith.dev";

// https://astro.build/config
Expand All @@ -24,7 +22,7 @@ export default defineConfig({
integrations: [
starlight({
title: "Genshi",
head: meta(SITE),
// head: meta(SITE),
pagination: true,
titleDelimiter: "/",
description:
Expand Down Expand Up @@ -55,6 +53,9 @@ export default defineConfig({
},
],
customCss: ["./src/tailwind.css", "@fontsource-variable/inter"],
components: {
Head: "./src/overrides/Head.astro",
},
}),
tailwind({ applyBaseStyles: false }),
react(),
Expand Down
27 changes: 0 additions & 27 deletions docs/meta.config.ts

This file was deleted.

2 changes: 2 additions & 0 deletions docs/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
Allow: /
1 change: 1 addition & 0 deletions docs/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const SITE = "https://genshi.samrith.dev";
1 change: 0 additions & 1 deletion docs/src/content/docs/guides/typescript.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: TypeScript
description: Making your Genshi store type-safe with TypeScript
prev: false
sidebar:
order: -2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Using with other libraries
description: Learn how to use Genshi with other libraries
next: false
sidebar:
order: 100
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/guides/using-with-react.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Using with React
description: Learn how to use Genshi with React
sidebar:
order: -1
---
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/project/core-concepts.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Core concepts
description: The core concepts of Genshi which make it unique.
sidebar:
order: 0
---
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/project/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Introduction
description: Manage your application state effectively with Genshi
sidebar:
order: -1
---
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/project/usage.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Getting Started
description: Start using Genshi in your JavaScript project.
next: false
sidebar:
order: 0
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/reference/package-core.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Core
description: API reference for the core package
prev: false
next: false
sidebar:
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/reference/package-react.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: React
description: API reference for the React package
prev: false
next: false
sidebar:
Expand Down
44 changes: 44 additions & 0 deletions docs/src/overrides/head.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
import type { Props } from "@astrojs/starlight/props";
import { SITE } from "../constants";
const {
entry: { id, data },
} = Astro.props;
const BASE_TITLE = "Genshi";
const DESCRIPTION =
"Simple, composable and effective state management for JavaScript";
const META_IMAGE = `${SITE}/banner.png`;
let title = data.title;
if (!id) {
title = `${BASE_TITLE} - ${DESCRIPTION}`;
} else {
title = `${title} / ${BASE_TITLE}`;
}
---

<!-- HTML Meta Tags -->
<title>{title}</title>
<link rel="sitemap" href="/sitemap-index.xml" />
<meta name="description" content={DESCRIPTION} />

<!-- Facebook Meta Tags -->
<meta property="og:url" content={SITE} />
<meta property="og:type" content="website" />
<meta property="og:title" content={title} />
<meta property="og:description" content={DESCRIPTION} />
<meta property="og:image" content={META_IMAGE} />

<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image" />
<meta property="twitter:domain" content="genshi.samrith.dev" />
<meta property="twitter:url" content={SITE} />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={DESCRIPTION} />
<meta name="twitter:image" content={META_IMAGE} />

<slot />
3 changes: 1 addition & 2 deletions docs/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { Card, CardGrid } from "@astrojs/starlight/components";

<StarlightPage
frontmatter={{
title: "Welcome",
description: "Simple, composable and effective state management",
title: "Genshi - Simple, composable and effective state management",
template: "splash",
hero: {
title: "Robust state management for your app that scales with you.",
Expand Down

0 comments on commit dbae0d6

Please sign in to comment.