@hagicode/hagilight-starlight 0.2.1-dev.14.1.41f9759 → 0.2.1-dev.15.1.e6bdd48
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/ArticlePromotion.astro +78 -22
- package/NotFoundHero.astro +44 -0
- package/article-promotion.mjs +109 -40
- package/assets/light-main.png +0 -0
- package/index.mjs +15 -0
- package/not-found.mjs +33 -0
- package/package.json +5 -3
package/ArticlePromotion.astro
CHANGED
|
@@ -1,52 +1,108 @@
|
|
|
1
1
|
---
|
|
2
|
+
import heroImage from './assets/light-main.png';
|
|
2
3
|
import { getArticlePromotionCopy } from './article-promotion.mjs';
|
|
3
4
|
|
|
4
5
|
const { lang } = Astro.props;
|
|
5
6
|
const copy = getArticlePromotionCopy(lang);
|
|
6
7
|
---
|
|
7
8
|
|
|
8
|
-
<
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</
|
|
9
|
+
<section class="hagilight-article-promotion" aria-labelledby="hagilight-article-promotion-title">
|
|
10
|
+
<div>
|
|
11
|
+
<h2 id="hagilight-article-promotion-title">{copy.title}</h2>
|
|
12
|
+
<p>{copy.lead}</p>
|
|
13
|
+
<p>{copy.subheadline}</p>
|
|
14
|
+
</div>
|
|
15
|
+
<img
|
|
16
|
+
src={heroImage.src}
|
|
17
|
+
alt={copy.imageAlt}
|
|
18
|
+
width={heroImage.width}
|
|
19
|
+
height={heroImage.height}
|
|
20
|
+
loading="lazy"
|
|
21
|
+
decoding="async"
|
|
22
|
+
/>
|
|
23
|
+
<ul aria-label={copy.title}>
|
|
24
|
+
{copy.features.map((feature) => (
|
|
25
|
+
<li>
|
|
26
|
+
<strong>{feature.label}</strong>
|
|
27
|
+
<span>{feature.description}</span>
|
|
28
|
+
</li>
|
|
29
|
+
))}
|
|
30
|
+
</ul>
|
|
31
|
+
<a href="https://www.hagicode.com/">{copy.visitLabel}</a>
|
|
32
|
+
</section>
|
|
13
33
|
|
|
14
34
|
<style>
|
|
15
35
|
.hagilight-article-promotion {
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
display: grid;
|
|
37
|
+
gap: 1rem;
|
|
38
|
+
margin: 2rem auto;
|
|
39
|
+
padding: clamp(1rem, 3vw, 1.75rem);
|
|
18
40
|
border: 1px solid var(--sl-color-gray-5);
|
|
19
|
-
border-radius:
|
|
41
|
+
border-radius: var(--sl-radius-lg);
|
|
20
42
|
background: var(--sl-color-bg-nav);
|
|
21
43
|
color: var(--sl-color-text);
|
|
22
44
|
}
|
|
23
45
|
|
|
24
46
|
.hagilight-article-promotion h2 {
|
|
25
47
|
margin: 0;
|
|
26
|
-
font-size: var(--sl-text-h3);
|
|
27
48
|
}
|
|
28
49
|
|
|
29
50
|
.hagilight-article-promotion p {
|
|
30
|
-
margin
|
|
51
|
+
margin: 0.5rem 0;
|
|
52
|
+
line-height: 1.6;
|
|
31
53
|
}
|
|
32
54
|
|
|
33
|
-
.hagilight-article-promotion
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
text-decoration: underline;
|
|
38
|
-
text-underline-offset: 0.15em;
|
|
55
|
+
.hagilight-article-promotion img {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: auto;
|
|
58
|
+
border-radius: var(--sl-radius-md);
|
|
39
59
|
}
|
|
40
60
|
|
|
41
|
-
.hagilight-article-promotion
|
|
42
|
-
|
|
61
|
+
.hagilight-article-promotion ul {
|
|
62
|
+
display: grid;
|
|
63
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
64
|
+
gap: 0.75rem;
|
|
65
|
+
padding: 0;
|
|
66
|
+
list-style: none;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.hagilight-article-promotion li {
|
|
70
|
+
display: grid;
|
|
71
|
+
gap: 0.5rem;
|
|
72
|
+
padding: 0.75rem;
|
|
73
|
+
border: 1px solid var(--sl-color-gray-5);
|
|
74
|
+
border-radius: var(--sl-radius-md);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.hagilight-article-promotion li strong {
|
|
78
|
+
color: var(--sl-color-text-accent);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.hagilight-article-promotion > a {
|
|
82
|
+
display: inline-flex;
|
|
83
|
+
justify-self: start;
|
|
84
|
+
align-items: center;
|
|
85
|
+
min-height: 2.75rem;
|
|
86
|
+
padding: 0.5rem 1rem;
|
|
87
|
+
border-radius: var(--sl-radius-sm);
|
|
88
|
+
background: var(--sl-color-text-accent);
|
|
89
|
+
color: var(--sl-color-bg);
|
|
90
|
+
font-weight: 700;
|
|
91
|
+
text-decoration: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.hagilight-article-promotion > a:hover {
|
|
95
|
+
filter: brightness(1.08);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.hagilight-article-promotion > a:focus-visible {
|
|
99
|
+
outline: 2px solid var(--sl-color-text-accent);
|
|
43
100
|
outline-offset: 3px;
|
|
44
|
-
border-radius: 2px;
|
|
45
101
|
}
|
|
46
102
|
|
|
47
|
-
@media (
|
|
48
|
-
.hagilight-article-promotion {
|
|
49
|
-
|
|
103
|
+
@media (max-width: 30rem) {
|
|
104
|
+
.hagilight-article-promotion ul {
|
|
105
|
+
grid-template-columns: 1fr;
|
|
50
106
|
}
|
|
51
107
|
}
|
|
52
108
|
</style>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
import DefaultHero from '@astrojs/starlight/components/Hero.astro';
|
|
3
|
+
import context from 'virtual:starlight/project-context';
|
|
4
|
+
import {
|
|
5
|
+
getNotFoundHomeHref,
|
|
6
|
+
getNotFoundHomeLabel,
|
|
7
|
+
isNotFoundEntry,
|
|
8
|
+
} from './not-found.mjs';
|
|
9
|
+
|
|
10
|
+
const route = Astro.locals.starlightRoute;
|
|
11
|
+
const isNotFound = isNotFoundEntry(route.entry.id);
|
|
12
|
+
const homeHref = getNotFoundHomeHref({
|
|
13
|
+
basePath: import.meta.env.BASE_URL,
|
|
14
|
+
locale: route.locale,
|
|
15
|
+
trailingSlash: context.trailingSlash,
|
|
16
|
+
});
|
|
17
|
+
const homeLabel = getNotFoundHomeLabel(route.lang);
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
isNotFound ? (
|
|
22
|
+
<div class="not-found-hero">
|
|
23
|
+
<DefaultHero />
|
|
24
|
+
<div class="recovery-action">
|
|
25
|
+
<a class="sl-link-button primary" href={homeHref}>{homeLabel}</a>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
) : (
|
|
29
|
+
<DefaultHero />
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
<style>
|
|
34
|
+
.not-found-hero {
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
align-items: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.recovery-action {
|
|
41
|
+
margin-block: 0.5rem 2rem;
|
|
42
|
+
text-align: center;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
package/article-promotion.mjs
CHANGED
|
@@ -1,53 +1,123 @@
|
|
|
1
1
|
const COPY = {
|
|
2
|
-
'
|
|
3
|
-
title: '
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
'zh-CN': {
|
|
3
|
+
title: 'HagiCode',
|
|
4
|
+
lead: 'HagiCode 是一套智能体编码工作台:结构化工作流、多 Agent 并行执行与 Hero Dungeon 视图,把想法变成真正交付的软件。',
|
|
5
|
+
subheadline: '让想法更快变成好用的软件,让智能编码更聪明、更高效,也更有趣。',
|
|
6
|
+
imageAlt: 'HagiCode 浅色主题主界面截图',
|
|
7
|
+
features: [
|
|
8
|
+
{ label: 'Smart', description: '结构化工作流将意图转化为从想法到交付的可执行路径。' },
|
|
9
|
+
{ label: 'Efficient', description: '多 Agent 工作流让调研、实现与审阅并行推进。' },
|
|
10
|
+
{ label: 'Fun', description: 'Hero Dungeon 让长时间编码协作更直观、更有参与感。' },
|
|
11
|
+
],
|
|
12
|
+
visitLabel: '访问 HagiCode',
|
|
6
13
|
},
|
|
7
14
|
'en-US': {
|
|
8
|
-
title: '
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
title: 'HagiCode',
|
|
16
|
+
lead: 'HagiCode is an agentic coding workspace: structured workflows, multi-agent execution, and Hero Dungeon views turn ideas into shipped software.',
|
|
17
|
+
subheadline: 'Turn ideas into polished, usable software with a smarter, faster, and more enjoyable agentic coding workflow.',
|
|
18
|
+
imageAlt: 'HagiCode light theme main interface screenshot',
|
|
19
|
+
features: [
|
|
20
|
+
{ label: 'Smart', description: 'Structured workflows turn intent into an executable path from idea to shipped change.' },
|
|
21
|
+
{ label: 'Efficient', description: 'Multi-agent workflows keep research, implementation, and review moving in parallel.' },
|
|
22
|
+
{ label: 'Fun', description: 'Hero Dungeon interfaces make long coding sessions visual, collaborative, and rewarding.' },
|
|
23
|
+
],
|
|
24
|
+
visitLabel: 'Visit HagiCode',
|
|
16
25
|
},
|
|
17
|
-
'
|
|
18
|
-
title: '
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
'zh-Hant': {
|
|
27
|
+
title: 'HagiCode',
|
|
28
|
+
lead: 'HagiCode 是智慧代理程式開發工作台,結合結構化工作流程、多代理程式執行與 Hero Dungeon 介面,將想法化為交付成果。',
|
|
29
|
+
subheadline: '以更聰明、更快速且更有趣的智慧代理程式工作流程,打造實用的軟體。',
|
|
30
|
+
imageAlt: 'HagiCode 淺色主題介面畫面',
|
|
31
|
+
features: [
|
|
32
|
+
{ label: 'Smart', description: '結構化流程將意圖轉化為從構想到交付的可執行步驟。' },
|
|
33
|
+
{ label: 'Efficient', description: '多代理程式工作流程讓研究、實作與審查並行進行。' },
|
|
34
|
+
{ label: 'Fun', description: 'Hero Dungeon 讓長時間的程式協作更直覺、更有參與感。' },
|
|
35
|
+
],
|
|
36
|
+
visitLabel: '造訪 HagiCode',
|
|
21
37
|
},
|
|
22
38
|
'ja-JP': {
|
|
23
|
-
title: 'HagiCode
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
title: 'HagiCode',
|
|
40
|
+
lead: 'HagiCode は構造化ワークフロー、マルチエージェント実行、Hero Dungeon ビューを備えたエージェント型コーディングワークスペースです。',
|
|
41
|
+
subheadline: 'よりスマートで速く、楽しいエージェント型ワークフローで、使いやすいソフトウェアを形にします。',
|
|
42
|
+
imageAlt: 'HagiCode ライトテーマのメイン画面',
|
|
43
|
+
features: [
|
|
44
|
+
{ label: 'Smart', description: '構造化ワークフローは意図をアイデアから変更のリリースまで実行可能な道筋にします。' },
|
|
45
|
+
{ label: 'Efficient', description: 'マルチエージェントのワークフローで調査、実装、レビューを並行して進めます。' },
|
|
46
|
+
{ label: 'Fun', description: 'Hero Dungeon により長時間のコーディングを視覚的で協力的な体験にします。' },
|
|
47
|
+
],
|
|
48
|
+
visitLabel: 'HagiCode を見る',
|
|
26
49
|
},
|
|
27
50
|
'ko-KR': {
|
|
28
|
-
title: 'HagiCode
|
|
29
|
-
|
|
30
|
-
|
|
51
|
+
title: 'HagiCode',
|
|
52
|
+
lead: 'HagiCode는 구조화된 워크플로, 다중 에이전트 실행, Hero Dungeon 뷰를 갖춘 에이전트 코딩 작업 공간입니다.',
|
|
53
|
+
subheadline: '더 스마트하고 빠르며 즐거운 에이전트 워크플로로 유용한 소프트웨어를 만드세요.',
|
|
54
|
+
imageAlt: 'HagiCode 라이트 테마 메인 화면',
|
|
55
|
+
features: [
|
|
56
|
+
{ label: 'Smart', description: '구조화된 워크플로는 의도를 아이디어부터 배포까지 실행 가능한 경로로 바꿉니다.' },
|
|
57
|
+
{ label: 'Efficient', description: '다중 에이전트 워크플로로 조사, 구현, 검토를 병렬로 진행합니다.' },
|
|
58
|
+
{ label: 'Fun', description: 'Hero Dungeon은 긴 코딩 세션을 시각적이고 협업적인 경험으로 만듭니다.' },
|
|
59
|
+
],
|
|
60
|
+
visitLabel: 'HagiCode 방문',
|
|
31
61
|
},
|
|
32
|
-
'
|
|
33
|
-
title: '
|
|
34
|
-
|
|
35
|
-
|
|
62
|
+
'de-DE': {
|
|
63
|
+
title: 'HagiCode',
|
|
64
|
+
lead: 'HagiCode ist ein agentischer Coding-Arbeitsplatz mit strukturierten Workflows, Multi-Agent-Ausführung und Hero-Dungeon-Ansichten.',
|
|
65
|
+
subheadline: 'Mit einem intelligenteren, schnelleren und unterhaltsameren agentischen Workflow wird aus Ideen nutzbare Software.',
|
|
66
|
+
imageAlt: 'HagiCode-Hauptoberfläche im hellen Design',
|
|
67
|
+
features: [
|
|
68
|
+
{ label: 'Smart', description: 'Strukturierte Workflows machen aus Absichten einen umsetzbaren Weg von der Idee bis zur Auslieferung.' },
|
|
69
|
+
{ label: 'Efficient', description: 'Multi-Agent-Workflows führen Recherche, Umsetzung und Prüfung parallel aus.' },
|
|
70
|
+
{ label: 'Fun', description: 'Hero Dungeon macht lange Coding-Sitzungen anschaulich und gemeinschaftlich.' },
|
|
71
|
+
],
|
|
72
|
+
visitLabel: 'HagiCode besuchen',
|
|
36
73
|
},
|
|
37
|
-
'
|
|
38
|
-
title: '
|
|
39
|
-
|
|
40
|
-
|
|
74
|
+
'fr-FR': {
|
|
75
|
+
title: 'HagiCode',
|
|
76
|
+
lead: 'HagiCode est un espace de développement agentique qui associe workflows structurés, exécution multi-agent et vues Hero Dungeon.',
|
|
77
|
+
subheadline: 'Transformez vos idées en logiciels utiles grâce à un workflow agentique plus intelligent, rapide et agréable.',
|
|
78
|
+
imageAlt: 'Interface principale de HagiCode en thème clair',
|
|
79
|
+
features: [
|
|
80
|
+
{ label: 'Smart', description: 'Des workflows structurés transforment une intention en parcours exécutable, de l’idée à la livraison.' },
|
|
81
|
+
{ label: 'Efficient', description: 'Les workflows multi-agents font avancer recherche, réalisation et revue en parallèle.' },
|
|
82
|
+
{ label: 'Fun', description: 'Hero Dungeon rend les longues sessions de code plus visuelles et collaboratives.' },
|
|
83
|
+
],
|
|
84
|
+
visitLabel: 'Visiter HagiCode',
|
|
41
85
|
},
|
|
42
|
-
'
|
|
43
|
-
title: '
|
|
44
|
-
|
|
45
|
-
|
|
86
|
+
'es-ES': {
|
|
87
|
+
title: 'HagiCode',
|
|
88
|
+
lead: 'HagiCode es un espacio de trabajo de programación con agentes, flujos estructurados, ejecución multiagente y vistas de Hero Dungeon.',
|
|
89
|
+
subheadline: 'Convierte ideas en software útil con un flujo de trabajo con agentes más inteligente, rápido y ameno.',
|
|
90
|
+
imageAlt: 'Interfaz principal de HagiCode con tema claro',
|
|
91
|
+
features: [
|
|
92
|
+
{ label: 'Smart', description: 'Los flujos estructurados convierten la intención en un itinerario ejecutable desde la idea hasta la entrega.' },
|
|
93
|
+
{ label: 'Efficient', description: 'Los flujos multiagente permiten avanzar en paralelo con la investigación, implementación y revisión.' },
|
|
94
|
+
{ label: 'Fun', description: 'Hero Dungeon hace que las largas sesiones de programación sean visuales y colaborativas.' },
|
|
95
|
+
],
|
|
96
|
+
visitLabel: 'Visitar HagiCode',
|
|
46
97
|
},
|
|
47
|
-
'
|
|
48
|
-
title: '
|
|
49
|
-
|
|
50
|
-
|
|
98
|
+
'pt-BR': {
|
|
99
|
+
title: 'HagiCode',
|
|
100
|
+
lead: 'HagiCode é um ambiente de programação com agentes, fluxos estruturados, execução multiagente e visualizações Hero Dungeon.',
|
|
101
|
+
subheadline: 'Transforme ideias em software útil com um fluxo de trabalho com agentes mais inteligente, rápido e agradável.',
|
|
102
|
+
imageAlt: 'Interface principal do HagiCode no tema claro',
|
|
103
|
+
features: [
|
|
104
|
+
{ label: 'Smart', description: 'Fluxos estruturados transformam intenções em um caminho executável da ideia à entrega.' },
|
|
105
|
+
{ label: 'Efficient', description: 'Fluxos multiagente mantêm pesquisa, implementação e revisão em andamento simultaneamente.' },
|
|
106
|
+
{ label: 'Fun', description: 'O Hero Dungeon torna longas sessões de programação mais visuais e colaborativas.' },
|
|
107
|
+
],
|
|
108
|
+
visitLabel: 'Acessar HagiCode',
|
|
109
|
+
},
|
|
110
|
+
'ru-RU': {
|
|
111
|
+
title: 'HagiCode',
|
|
112
|
+
lead: 'HagiCode — агентная среда разработки со структурированными процессами, параллельным выполнением несколькими агентами и интерфейсами Hero Dungeon.',
|
|
113
|
+
subheadline: 'Превращайте идеи в полезное ПО с более умным, быстрым и увлекательным агентным рабочим процессом.',
|
|
114
|
+
imageAlt: 'Главный экран HagiCode в светлой теме',
|
|
115
|
+
features: [
|
|
116
|
+
{ label: 'Smart', description: 'Структурированные процессы превращают намерение в исполнимый путь от идеи до готового изменения.' },
|
|
117
|
+
{ label: 'Efficient', description: 'Мультиагентные процессы параллельно продвигают исследование, реализацию и проверку.' },
|
|
118
|
+
{ label: 'Fun', description: 'Hero Dungeon делает длительную совместную разработку наглядной и увлекательной.' },
|
|
119
|
+
],
|
|
120
|
+
visitLabel: 'Перейти на HagiCode',
|
|
51
121
|
},
|
|
52
122
|
};
|
|
53
123
|
|
|
@@ -62,8 +132,7 @@ function resolveArticlePromotion(frontmatterValue, siteDefault = true) {
|
|
|
62
132
|
}
|
|
63
133
|
|
|
64
134
|
function getArticlePromotionCopy(lang) {
|
|
65
|
-
|
|
66
|
-
return COPY[lang] ?? COPY[language] ?? COPY['en-US'];
|
|
135
|
+
return COPY[lang] ?? COPY['en-US'];
|
|
67
136
|
}
|
|
68
137
|
|
|
69
138
|
export { COPY, getArticlePromotionCopy, resolveArticlePromotion };
|
|
Binary file
|
package/index.mjs
CHANGED
|
@@ -179,6 +179,13 @@ export default function hagilight(options = {}) {
|
|
|
179
179
|
if (options.header?.enabled !== undefined && typeof options.header.enabled !== 'boolean') {
|
|
180
180
|
throw new TypeError('Hagilight header enabled option must be a boolean.');
|
|
181
181
|
}
|
|
182
|
+
if (options.notFoundPage !== undefined
|
|
183
|
+
&& (!options.notFoundPage || typeof options.notFoundPage !== 'object' || Array.isArray(options.notFoundPage))) {
|
|
184
|
+
throw new TypeError('Hagilight notFoundPage options must be an object.');
|
|
185
|
+
}
|
|
186
|
+
if (options.notFoundPage?.enabled !== undefined && typeof options.notFoundPage.enabled !== 'boolean') {
|
|
187
|
+
throw new TypeError('Hagilight notFoundPage enabled option must be a boolean.');
|
|
188
|
+
}
|
|
182
189
|
if (options.analytics !== undefined
|
|
183
190
|
&& (!options.analytics || typeof options.analytics !== 'object' || Array.isArray(options.analytics))) {
|
|
184
191
|
throw new TypeError('Hagilight analytics options must be an object.');
|
|
@@ -209,12 +216,16 @@ export default function hagilight(options = {}) {
|
|
|
209
216
|
});
|
|
210
217
|
const instanceId = randomUUID();
|
|
211
218
|
const headerEnabled = options.header?.enabled !== false;
|
|
219
|
+
const notFoundPageEnabled = options.notFoundPage?.enabled !== false;
|
|
212
220
|
const pageTitleEnabled = options.contentComponents?.pageTitle !== false;
|
|
213
221
|
const markdownContentEnabled = options.contentComponents?.markdownContent !== false;
|
|
214
222
|
const componentIds = {
|
|
215
223
|
header: headerEnabled
|
|
216
224
|
? `virtual:hagilight-starlight/${instanceId}/Header.astro`
|
|
217
225
|
: undefined,
|
|
226
|
+
hero: notFoundPageEnabled
|
|
227
|
+
? fileURLToPath(new URL('./NotFoundHero.astro', import.meta.url))
|
|
228
|
+
: undefined,
|
|
218
229
|
footer: `virtual:hagilight-starlight/${instanceId}/Footer.astro`,
|
|
219
230
|
pageTitle: pageTitleEnabled ? `virtual:hagilight-starlight/${instanceId}/PageTitle.astro` : undefined,
|
|
220
231
|
markdownContent: markdownContentEnabled
|
|
@@ -240,6 +251,9 @@ export default function hagilight(options = {}) {
|
|
|
240
251
|
if (headerEnabled && config.components?.Header) {
|
|
241
252
|
throw new Error('Hagilight cannot replace an existing Starlight Header override. Set header: { enabled: false } to keep it, or compose @hagicode/hagilight-starlight/Header directly.');
|
|
242
253
|
}
|
|
254
|
+
if (notFoundPageEnabled && config.components?.Hero) {
|
|
255
|
+
throw new Error('Hagilight cannot replace an existing Starlight Hero override. Set notFoundPage: { enabled: false } to keep it, or compose @hagicode/hagilight-starlight/NotFoundHero directly.');
|
|
256
|
+
}
|
|
243
257
|
if (config.components?.Footer) {
|
|
244
258
|
throw new Error('Hagilight cannot replace an existing Starlight Footer override.');
|
|
245
259
|
}
|
|
@@ -264,6 +278,7 @@ export default function hagilight(options = {}) {
|
|
|
264
278
|
components: {
|
|
265
279
|
...config.components,
|
|
266
280
|
...(componentIds.header ? { Header: componentIds.header } : {}),
|
|
281
|
+
...(componentIds.hero ? { Hero: componentIds.hero } : {}),
|
|
267
282
|
Footer: componentIds.footer,
|
|
268
283
|
...(componentIds.pageTitle ? { PageTitle: componentIds.pageTitle } : {}),
|
|
269
284
|
...(componentIds.markdownContent ? { MarkdownContent: componentIds.markdownContent } : {}),
|
package/not-found.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const homeLabels = {
|
|
2
|
+
de: 'Zur Startseite',
|
|
3
|
+
en: 'Back to home',
|
|
4
|
+
es: 'Volver al inicio',
|
|
5
|
+
fr: 'Retour à l’accueil',
|
|
6
|
+
ja: 'ホームに戻る',
|
|
7
|
+
ko: '홈으로 돌아가기',
|
|
8
|
+
pt: 'Voltar ao início',
|
|
9
|
+
ru: 'На главную',
|
|
10
|
+
'zh-cn': '返回首页',
|
|
11
|
+
'zh-hant': '返回首頁',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function isNotFoundEntry(entryId) {
|
|
15
|
+
return entryId === '404' || entryId.endsWith('/404');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getNotFoundHomeHref({ basePath = '/', locale, trailingSlash = 'ignore' }) {
|
|
19
|
+
const base = basePath.replace(/\/+$/u, '');
|
|
20
|
+
const localePath = locale && locale !== 'root' ? `/${locale}` : '';
|
|
21
|
+
const path = `${base}${localePath}` || '/';
|
|
22
|
+
|
|
23
|
+
if (trailingSlash === 'never') {
|
|
24
|
+
return path.replace(/\/+$/u, '') || '/';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return `${path.replace(/\/+$/u, '')}/`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function getNotFoundHomeLabel(lang) {
|
|
31
|
+
const language = lang?.replaceAll('_', '-').toLowerCase() ?? 'en';
|
|
32
|
+
return homeLabels[language] ?? homeLabels[language.split('-')[0]] ?? homeLabels.en;
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/hagilight-starlight",
|
|
3
|
-
"version": "0.2.1-dev.
|
|
3
|
+
"version": "0.2.1-dev.15.1.e6bdd48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Starlight customizations for HagiCode documentation",
|
|
6
6
|
"repository": {
|
|
@@ -22,16 +22,18 @@
|
|
|
22
22
|
"./MarkdownContent": "./MarkdownContent.astro",
|
|
23
23
|
"./ArticlePromotion": "./ArticlePromotion.astro",
|
|
24
24
|
"./PageTitle": "./PageTitle.astro",
|
|
25
|
+
"./NotFoundHero": "./NotFoundHero.astro",
|
|
25
26
|
"./PromotoFooter": "./PromotoFooter.astro"
|
|
26
27
|
},
|
|
27
28
|
"files": [
|
|
28
29
|
"index.mjs",
|
|
29
30
|
"*.css",
|
|
30
31
|
"*.mjs",
|
|
31
|
-
"*.astro"
|
|
32
|
+
"*.astro",
|
|
33
|
+
"assets/*.png"
|
|
32
34
|
],
|
|
33
35
|
"dependencies": {
|
|
34
|
-
"@hagicode/hagilight": "0.2.1-dev.
|
|
36
|
+
"@hagicode/hagilight": "0.2.1-dev.15.1.e6bdd48"
|
|
35
37
|
},
|
|
36
38
|
"peerDependencies": {
|
|
37
39
|
"@astrojs/starlight": "^0.42.4",
|