Skip to content

Commit ebd26f6

Browse files
authored
Merge branch 'main' into doc-meta
2 parents 4e79398 + b57a764 commit ebd26f6

File tree

22 files changed

+193
-10
lines changed

22 files changed

+193
-10
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# [1.1.0](https://github.com/stackblitz/tutorialkit/compare/1.0.0...1.1.0) (2024-10-18)
2+
3+
4+
### Bug Fixes
5+
6+
* **astro:** correct error message when chapter not found ([#361](https://github.com/stackblitz/tutorialkit/issues/361)) ([0510474](https://github.com/stackblitz/tutorialkit/commit/05104741a73180dbaeb583317cd77df104d2d2c7))
7+
* **astro:** types of override components to optional ([#376](https://github.com/stackblitz/tutorialkit/issues/376)) ([0af3848](https://github.com/stackblitz/tutorialkit/commit/0af384889f5a3e7e46ea4803b1b1a631c15d331f))
8+
* **cli:** list `eject` command in `--help` ([#373](https://github.com/stackblitz/tutorialkit/issues/373)) ([bc61229](https://github.com/stackblitz/tutorialkit/commit/bc61229f156db3043b57dd3f85f09b72702a70b0))
9+
10+
11+
### Features
12+
13+
* add file extension based icons ([#369](https://github.com/stackblitz/tutorialkit/issues/369)) ([ff39cdc](https://github.com/stackblitz/tutorialkit/commit/ff39cdc258764c8d4d1bebe2dce2795fe10e1870))
14+
* **astro:** add `custom` configuration option for passing custom fields ([#378](https://github.com/stackblitz/tutorialkit/issues/378)) ([7c6ede9](https://github.com/stackblitz/tutorialkit/commit/7c6ede95730150b68be763d4c87f1da1bc42503c))
15+
* **astro:** override components to support `HeadTags` ([#375](https://github.com/stackblitz/tutorialkit/issues/375)) ([e93d11a](https://github.com/stackblitz/tutorialkit/commit/e93d11a11b8a01dc6de859842b0dc675b01008de))
16+
17+
18+
119
# [1.0.0](https://github.com/stackblitz/tutorialkit/compare/0.2.3...1.0.0) (2024-10-01)
220

321

docs/tutorialkit.dev/src/content/docs/reference/configuration.mdx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,58 @@ type TemplateType = "html" | "node" | "angular-cli" | "create-react-app" | "java
404404
405405
```
406406

407+
##### `meta`
408+
409+
Configures `<meta>` tags for Open Graph protocole and Twitter.
410+
TutorialKit will use your logo as the default image.
411+
<PropertyTable inherited type="MetaTagsSchema" />
412+
413+
The `MetaTagsSchema` type has the following shape:
414+
415+
```ts
416+
type MetaTagsSchema = {
417+
image?: string;
418+
description?: string;
419+
title?: string;
420+
}
421+
422+
```
423+
424+
Example value:
425+
```yaml
426+
meta:
427+
image: /cover.png
428+
title: Title shown on social media and search engines
429+
description: Description shown on social media and search engines
430+
```
431+
432+
:::tip
433+
If your logo uses the SVG format, it may not display on most social platforms.
434+
Use a raster format instead, such as WEBP or PNG.
435+
:::
436+
437+
##### `custom`
438+
439+
Assign custom fields to a chapter/part/lesson.
440+
<PropertyTable inherited type="Record<string,any>" />
441+
442+
This is useful when you want to consume items for the default `tutorial` collection
443+
in order to implement custom features.
444+
445+
```yaml
446+
custom:
447+
publishedAt: 2024-16-10
448+
tags: tutorialkit,astro,vite
449+
```
450+
451+
```ts
452+
import { getCollection } from 'astro:content';
453+
const collection = await getCollection('tutorial');
454+
for (const entry of collection) {
455+
console.log("This part was published at:", entry.data?.custom?.publishedAt)
456+
}
457+
```
458+
407459
## Configure the Tutorialkit Astro integration
408460

409461
`@tutorialkit/astro` is an integration for Astro. You can configure the integration in your `astro.config.ts` file.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
import { getCollection } from 'astro:content';
3+
const collection = await getCollection('tutorial');
4+
5+
const lesson = collection.find((c) => c.data.type === 'lesson' && c.slug.startsWith(Astro.params.slug!))!;
6+
const { custom } = lesson.data;
7+
---
8+
9+
<h2>Custom metadata</h2>
10+
11+
<pre>{JSON.stringify(custom, null,2)}</pre>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
type: lesson
3+
title: Custom
4+
terminal:
5+
panels: terminal
6+
custom:
7+
custom-message: 'Hello world'
8+
numeric-field: 5173
9+
---
10+
11+
import CustomMetaData from "@components/CustomMetadata.astro"
12+
13+
# Metadata test - Custom
14+
15+
<CustomMetaData />
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: chapter
3+
title: Metadata
4+
---

e2e/test/metadata.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
const BASE_URL = '/tests/metadata';
4+
5+
test('developer can pass custom metadata to lesson', async ({ page }) => {
6+
await page.goto(`${BASE_URL}/custom`);
7+
await expect(page.getByRole('heading', { level: 1, name: 'Metadata test - Custom' })).toBeVisible();
8+
9+
await expect(page.getByRole('heading', { level: 2, name: 'Custom metadata' })).toBeVisible();
10+
11+
await expect(page.getByText('"custom-message": "Hello world"')).toBeVisible();
12+
await expect(page.getByText('"numeric-field": 5173')).toBeVisible();
13+
});

packages/astro/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# [1.1.0](https://github.com/stackblitz/tutorialkit/compare/1.0.0...1.1.0) "@tutorialkit/astro" (2024-10-18)
2+
3+
4+
### Bug Fixes
5+
6+
* **astro:** correct error message when chapter not found ([#361](https://github.com/stackblitz/tutorialkit/issues/361)) ([0510474](https://github.com/stackblitz/tutorialkit/commit/05104741a73180dbaeb583317cd77df104d2d2c7))
7+
* **astro:** types of override components to optional ([#376](https://github.com/stackblitz/tutorialkit/issues/376)) ([0af3848](https://github.com/stackblitz/tutorialkit/commit/0af384889f5a3e7e46ea4803b1b1a631c15d331f))
8+
9+
10+
### Features
11+
12+
* **astro:** override components to support `HeadTags` ([#375](https://github.com/stackblitz/tutorialkit/issues/375)) ([e93d11a](https://github.com/stackblitz/tutorialkit/commit/e93d11a11b8a01dc6de859842b0dc675b01008de))
13+
14+
15+
116
# [1.0.0](https://github.com/stackblitz/tutorialkit/compare/0.2.3...1.0.0) "@tutorialkit/astro" (2024-10-01)
217

318

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tutorialkit/astro",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "TutorialKit integration for Astro (https://astro.build)",
55
"author": "StackBlitz Inc.",
66
"type": "module",

packages/cli/CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# [1.1.0](https://github.com/stackblitz/tutorialkit/compare/1.0.0...1.1.0) "@tutorialkit/cli" (2024-10-18)
2+
3+
4+
### Bug Fixes
5+
6+
* **cli:** list `eject` command in `--help` ([#373](https://github.com/stackblitz/tutorialkit/issues/373)) ([bc61229](https://github.com/stackblitz/tutorialkit/commit/bc61229f156db3043b57dd3f85f09b72702a70b0))
7+
8+
9+
### Features
10+
11+
* add file extension based icons ([#369](https://github.com/stackblitz/tutorialkit/issues/369)) ([ff39cdc](https://github.com/stackblitz/tutorialkit/commit/ff39cdc258764c8d4d1bebe2dce2795fe10e1870))
12+
* **astro:** override components to support `HeadTags` ([#375](https://github.com/stackblitz/tutorialkit/issues/375)) ([e93d11a](https://github.com/stackblitz/tutorialkit/commit/e93d11a11b8a01dc6de859842b0dc675b01008de))
13+
14+
15+
116
# [1.0.0](https://github.com/stackblitz/tutorialkit/compare/0.2.3...1.0.0) "@tutorialkit/cli" (2024-10-01)
217

318

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tutorialkit/cli",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "Interactive tutorials powered by WebContainer API",
55
"author": "StackBlitz Inc.",
66
"type": "module",

0 commit comments

Comments
 (0)