Skip to content

Commit e61cb26

Browse files
committed
fix(astro): add meta tags to redirect page too
1 parent eca8edc commit e61cb26

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/astro/src/default/pages/index.astro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
import MetaTags from '../components/MetaTags.astro';
23
import { getTutorial } from '../utils/content';
34
import { joinPaths } from '../utils/url';
45
@@ -9,11 +10,16 @@ const part = lesson.part && tutorial.parts[lesson.part.id];
910
const chapter = lesson.chapter && part?.chapters[lesson.chapter.id];
1011
1112
const slug = [part?.slug, chapter?.slug, lesson.slug].filter(Boolean).join('/');
13+
const meta = lesson.data?.meta ?? {};
14+
15+
meta.title ??= [lesson.part?.title, lesson.chapter?.title, lesson.data.title].filter(Boolean).join(' / ');
16+
meta.description ??= 'A TutorialKit interactive lesson';
1217
1318
const redirect = joinPaths(import.meta.env.BASE_URL, `/${slug}`);
1419
---
1520

1621
<!doctype html>
1722
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
1823
<title>Redirecting to {redirect}</title>
24+
<MetaTags slot="meta" meta={meta} />
1925
<meta http-equiv="refresh" content=`0;url=${redirect}` />

0 commit comments

Comments
 (0)