@mannisto/astro-metadata 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -96
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,8 +171,7 @@ Best for sites with deeply nested layouts, or when you want to keep metadata co-
|
|
|
171
171
|
|
|
172
172
|
## Components
|
|
173
173
|
|
|
174
|
-
|
|
175
|
-
<summary><strong>Canonical</strong></summary>
|
|
174
|
+
### Canonical
|
|
176
175
|
|
|
177
176
|
Renders a canonical link tag. Falls back to `Astro.url.href` when no value is provided, so every page gets a canonical tag with zero configuration.
|
|
178
177
|
|
|
@@ -184,10 +183,8 @@ Renders a canonical link tag. Falls back to `Astro.url.href` when no value is pr
|
|
|
184
183
|
| ------- | -------- | -------------------------------------------- |
|
|
185
184
|
| `value` | `string` | Canonical URL. Defaults to `Astro.url.href`. |
|
|
186
185
|
|
|
187
|
-
|
|
186
|
+
### Description
|
|
188
187
|
|
|
189
|
-
<details>
|
|
190
|
-
<summary><strong>Description</strong></summary>
|
|
191
188
|
```astro
|
|
192
189
|
<Description value="Welcome to my site" />
|
|
193
190
|
```
|
|
@@ -196,10 +193,7 @@ Renders a canonical link tag. Falls back to `Astro.url.href` when no value is pr
|
|
|
196
193
|
| ------- | -------- | ---------------- |
|
|
197
194
|
| `value` | `string` | Page description |
|
|
198
195
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
<details>
|
|
202
|
-
<summary><strong>Favicon</strong></summary>
|
|
196
|
+
### Favicon
|
|
203
197
|
|
|
204
198
|
Favicon support with light and dark mode variants, automatic MIME type detection, and automatic sorting.
|
|
205
199
|
|
|
@@ -234,10 +228,7 @@ Icons are automatically sorted in the recommended browser order: `ico` → `png`
|
|
|
234
228
|
| `theme` | `"light" \| "dark"` | Adds a `prefers-color-scheme` media query |
|
|
235
229
|
| `apple` | `boolean` | Renders as `<link rel="apple-touch-icon">` |
|
|
236
230
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
<details>
|
|
240
|
-
<summary><strong>Head</strong></summary>
|
|
231
|
+
### Head
|
|
241
232
|
|
|
242
233
|
Wraps the entire page head and composes all sub-components internally. Charset and viewport are always included and can be overridden if needed.
|
|
243
234
|
|
|
@@ -288,10 +279,8 @@ Wraps the entire page head and composes all sub-components internally. Charset a
|
|
|
288
279
|
</Head>
|
|
289
280
|
```
|
|
290
281
|
|
|
291
|
-
|
|
282
|
+
### Keywords
|
|
292
283
|
|
|
293
|
-
<details>
|
|
294
|
-
<summary><strong>Keywords</strong></summary>
|
|
295
284
|
```astro
|
|
296
285
|
<Keywords value={["astro", "seo", "metadata"]} />
|
|
297
286
|
```
|
|
@@ -300,10 +289,7 @@ Wraps the entire page head and composes all sub-components internally. Charset a
|
|
|
300
289
|
| ------- | ---------- | ---------------- |
|
|
301
290
|
| `value` | `string[]` | List of keywords |
|
|
302
291
|
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<details>
|
|
306
|
-
<summary><strong>LanguageAlternates</strong></summary>
|
|
292
|
+
### LanguageAlternates
|
|
307
293
|
|
|
308
294
|
Renders `<link rel="alternate" hreflang>` tags for multilingual sites. Tells search engines which language version to serve for a given region.
|
|
309
295
|
|
|
@@ -323,10 +309,7 @@ Renders `<link rel="alternate" hreflang>` tags for multilingual sites. Tells sea
|
|
|
323
309
|
| `alternates[].href` | `string` | Full URL of the alternate page |
|
|
324
310
|
| `alternates[].hreflang` | `string` | Language or region code, e.g. `en`, `fi`, `en-US`, `x-default` |
|
|
325
311
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
<details>
|
|
329
|
-
<summary><strong>OpenGraph</strong></summary>
|
|
312
|
+
### OpenGraph
|
|
330
313
|
|
|
331
314
|
Renders Open Graph meta tags for rich previews when your pages are shared on social platforms. When used inside `Head`, `title`, `description` and `url` fall back to the page values automatically.
|
|
332
315
|
|
|
@@ -404,10 +387,7 @@ Renders Open Graph meta tags for rich previews when your pages are shared on soc
|
|
|
404
387
|
| `secureUrl` | `string` | HTTPS audio URL |
|
|
405
388
|
| `type` | `string` | MIME type, e.g. `"audio/mpeg"` |
|
|
406
389
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
<details>
|
|
410
|
-
<summary><strong>Robots</strong></summary>
|
|
390
|
+
### Robots
|
|
411
391
|
|
|
412
392
|
Controls how search engines crawl and index your page. Defaults to `index, follow`.
|
|
413
393
|
|
|
@@ -423,10 +403,7 @@ Controls how search engines crawl and index your page. Defaults to `index, follo
|
|
|
423
403
|
| `snippet` | `boolean` | `true` | Allow text snippets in search results |
|
|
424
404
|
| `extra` | `string` | — | Additional directives, e.g. `"max-snippet:-1, max-image-preview:large"` |
|
|
425
405
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
<details>
|
|
429
|
-
<summary><strong>Schema</strong></summary>
|
|
406
|
+
### Schema
|
|
430
407
|
|
|
431
408
|
Outputs a `<script type="application/ld+json">` tag for structured data. Use it to help search engines understand your content and qualify for rich results.
|
|
432
409
|
|
|
@@ -445,10 +422,7 @@ Outputs a `<script type="application/ld+json">` tag for structured data. Use it
|
|
|
445
422
|
| -------- | ------------------------- | -------------- |
|
|
446
423
|
| `schema` | `Record<string, unknown>` | JSON-LD object |
|
|
447
424
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<details>
|
|
451
|
-
<summary><strong>Title</strong></summary>
|
|
425
|
+
### Title
|
|
452
426
|
|
|
453
427
|
Renders the `<title>` tag. The template must contain `%s`, which is replaced with the page title — TypeScript enforces this at the type level.
|
|
454
428
|
|
|
@@ -461,10 +435,7 @@ Renders the `<title>` tag. The template must contain `%s`, which is replaced wit
|
|
|
461
435
|
| `value` | `string` | Page title. Required. |
|
|
462
436
|
| `template` | `` `${string}%s${string}` `` | Template string. Must contain `%s`. |
|
|
463
437
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
<details>
|
|
467
|
-
<summary><strong>Twitter</strong></summary>
|
|
438
|
+
### Twitter
|
|
468
439
|
|
|
469
440
|
Renders Twitter card meta tags for rich previews on X. When used inside `Head`, `title` and `description` fall back to the page values automatically.
|
|
470
441
|
|
|
@@ -492,71 +463,21 @@ Renders Twitter card meta tags for rich previews on X. When used inside `Head`,
|
|
|
492
463
|
| `image.url` | `string` | — | Image URL. Required if image is set. |
|
|
493
464
|
| `image.alt` | `string` | — | Image alt text |
|
|
494
465
|
|
|
495
|
-
</details>
|
|
496
|
-
|
|
497
466
|
## Contributing
|
|
498
467
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
Clone the repository and run the init script:
|
|
502
|
-
|
|
503
|
-
```bash
|
|
504
|
-
git clone https://github.com/eremannisto/astro-metadata
|
|
505
|
-
cd astro-metadata
|
|
506
|
-
pnpm run init
|
|
507
|
-
```
|
|
508
|
-
|
|
509
|
-
This installs all dependencies, links the local package to the fixture project, and installs Playwright browsers.
|
|
510
|
-
|
|
511
|
-
### Running tests
|
|
512
|
-
|
|
513
|
-
Run unit tests only:
|
|
514
|
-
|
|
515
|
-
```bash
|
|
516
|
-
pnpm test:unit
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
Run end-to-end component tests:
|
|
520
|
-
|
|
521
|
-
```bash
|
|
522
|
-
pnpm test:e2e
|
|
523
|
-
```
|
|
524
|
-
|
|
525
|
-
Run all tests:
|
|
526
|
-
|
|
527
|
-
```bash
|
|
528
|
-
pnpm test:all
|
|
529
|
-
```
|
|
530
|
-
|
|
531
|
-
### Linting and formatting
|
|
532
|
-
|
|
533
|
-
This project uses [Biome](https://biomejs.dev) for linting and formatting.
|
|
534
|
-
|
|
535
|
-
Check for issues:
|
|
536
|
-
|
|
537
|
-
```bash
|
|
538
|
-
pnpm check
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
Auto-fix issues:
|
|
542
|
-
|
|
543
|
-
```bash
|
|
544
|
-
pnpm check:fix
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
All pull requests must pass the Biome check and unit tests before merging. These are enforced automatically via GitHub Actions.
|
|
468
|
+
Clone the repo and run `pnpm run init` to install dependencies, link the local package to the fixture project, and set up Playwright. Then use `pnpm test:unit`, `pnpm test:e2e`, or `pnpm test:all` to run tests, and `pnpm check` / `pnpm format` for linting and formatting. All PRs must pass `pnpm check` — enforced via GitHub Actions.
|
|
548
469
|
|
|
549
470
|
### Project structure
|
|
550
471
|
|
|
551
472
|
```
|
|
552
473
|
astro-metadata/
|
|
553
474
|
src/
|
|
554
|
-
components/
|
|
555
|
-
lib/
|
|
475
|
+
components/
|
|
476
|
+
lib/
|
|
556
477
|
tests/
|
|
557
478
|
e2e/
|
|
558
|
-
components/
|
|
559
|
-
fixtures/
|
|
479
|
+
components/
|
|
480
|
+
fixtures/
|
|
560
481
|
unit/
|
|
561
482
|
metadata.test.ts
|
|
562
483
|
scripts/
|
|
@@ -565,8 +486,9 @@ astro-metadata/
|
|
|
565
486
|
playwright.config.ts
|
|
566
487
|
vitest.config.ts
|
|
567
488
|
biome.json
|
|
489
|
+
prettier.config.ts
|
|
568
490
|
```
|
|
569
491
|
|
|
570
492
|
## License
|
|
571
493
|
|
|
572
|
-
MIT © [Ere Männistö](https://github.com/eremannisto)
|
|
494
|
+
MIT © [Ere Männistö](https://github.com/eremannisto)
|
package/package.json
CHANGED