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 361b439
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 44 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.

7 changes: 5 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "docs",
"type": "module",
"version": "0.0.1",
"version": "0.0.0",
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev": "astro dev",
"start": "astro dev",
Expand Down Expand Up @@ -36,5 +38,6 @@
"eslint-plugin-astro": "~1.3.1",
"prettier-plugin-astro": "~0.14.1",
"typescript": "~5.7.2"
}
},
"packageManager": "[email protected]"
}
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
45 changes: 45 additions & 0 deletions docs/src/overrides/head.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
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="icon" href="/favicon.svg" sizes="any" type="image/svg+xml" />
<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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"author": "Samrith Shankar <[email protected]>",
"license": "MIT",
"homepage": "https://github.com/samrith-s/genshi#readme",
"private": true,
"type": "module",
"source": "src/index.ts",
"module": "lib/index.js",
Expand Down Expand Up @@ -59,5 +60,5 @@
"vite-plugin-dts": "~3.9.1",
"vitest": "~1.6.0"
},
"packageManager": "yarn@4.5.3"
"packageManager": "yarn@4.6.0"
}

0 comments on commit 361b439

Please sign in to comment.