Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liruifengv/starlight-head
A Starlight plugin for easy to add <head> for your Starlight site
https://github.com/liruifengv/starlight-head
astro head plugin starlight
Last synced: about 2 months ago
JSON representation
A Starlight plugin for easy to add <head> for your Starlight site
- Host: GitHub
- URL: https://github.com/liruifengv/starlight-head
- Owner: liruifengv
- License: mit
- Created: 2024-03-19T08:54:02.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-04-09T02:47:24.000Z (10 months ago)
- Last Synced: 2024-12-11T00:04:46.856Z (about 2 months ago)
- Topics: astro, head, plugin, starlight
- Language: TypeScript
- Homepage:
- Size: 201 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## starlight-head
A Starlight plugin for easy to add `` for your Starlight site.
### Installation
```bash
npm install -D starlight-head
```### Usage
```js
// astro.config.mjs
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import starlightHead from "starlight-head";export default defineConfig({
integrations: [
starlight({
title: "My Docs",
plugins: [
starlightHead({
path: "./src/components/head.astro",
}),
],
}),
],
});
``````astro
// src/components/head.astro
---
---window.onload = function() {
console.log("Page loaded");
}```
It will be covert to Starlight config:
```js
starlight({
head: [
{
tag: "meta",
attributes: {
name: "description",
content: "This is a description by starlight-head-plugin",
},
},
{
tag: "script",
content: 'window.onload = function() {\n\tconsole.log("Page loaded");\n}',
},
],
});
```### Features
- [x] Add `` content to Starlight by `.astro` component.
- [ ] Support expressions in `.astro` component.
- [ ] Supports importing variables from other files.
- [ ] Support add `` for certain page.### Configuration Reference
#### path (required)
**type:** `string`
A path to the file that contains the `` content. Like `./src/components/head.astro`.
### License
MIT