@hagicode/hagilight 0.2.3-dev.22.1.69e2b54 → 0.2.3-dev.24.1.02be9bf

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/site-links.ts +24 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hagicode/hagilight",
3
- "version": "0.2.3-dev.22.1.69e2b54",
3
+ "version": "0.2.3-dev.24.1.02be9bf",
4
4
  "type": "module",
5
5
  "description": "Shared Astro components for HagiCode sites",
6
6
  "repository": {
package/site-links.ts CHANGED
@@ -10,6 +10,7 @@ export type SiteLinkKey =
10
10
  | 'productDocs'
11
11
  | 'blogPosts'
12
12
  | 'rss'
13
+ | 'rssLocale'
13
14
  | 'costCalculator'
14
15
  | 'github'
15
16
  | 'discord'
@@ -61,6 +62,7 @@ export interface SiteLinksOptions {
61
62
  removeLinks?: Partial<Record<FooterLinkSection, readonly string[]>>;
62
63
  relatedSites?: readonly RelatedSite[];
63
64
  rssFeedUrl?: string;
65
+ rssLocaleFeedUrl?: string;
64
66
  siteId?: string;
65
67
  siteUrl?: string;
66
68
  }
@@ -124,6 +126,12 @@ const translations = {
124
126
  'ja-JP': 'RSS 配信', 'ko-KR': 'RSS 구독', 'de-DE': 'RSS-Feed',
125
127
  'fr-FR': 'Flux RSS', 'es-ES': 'RSS', 'pt-BR': 'Feed RSS', 'ru-RU': 'RSS-лента',
126
128
  },
129
+ rssLocale: {
130
+ 'zh-CN': '当前语言 RSS', 'zh-Hant': '目前語言 RSS', 'en-US': 'Current language RSS',
131
+ 'ja-JP': '現在の言語 RSS', 'ko-KR': '현재 언어 RSS', 'de-DE': 'RSS der aktuellen Sprache',
132
+ 'fr-FR': 'Flux RSS de la langue actuelle', 'es-ES': 'RSS del idioma actual',
133
+ 'pt-BR': 'Feed RSS do idioma atual', 'ru-RU': 'RSS для текущего языка',
134
+ },
127
135
  costCalculator: {
128
136
  'zh-CN': '算一算,AI会不会淘汰我', 'zh-Hant': '算一算,AI 會不會淘汰我',
129
137
  'en-US': 'Will AI Replace Me?', 'ja-JP': 'AI に置き換えられるか診断',
@@ -181,6 +189,7 @@ const defaultLinks: Record<SiteLinkKey, LinkDefinition> = {
181
189
  productDocs: { label: translations.productDocs, href: (locale) => docsPath(locale, '/product-overview/') },
182
190
  blogPosts: { label: translations.blogPosts, href: (locale) => docsPath(locale, '/blog/') },
183
191
  rss: { label: translations.rss, href: '' },
192
+ rssLocale: { label: translations.rssLocale, href: '' },
184
193
  costCalculator: { label: translations.costCalculator, href: 'https://cost.hagicode.com', external: true },
185
194
  github: { label: translations.github, href: 'https://github.com/HagiCode-org/site', external: true },
186
195
  discord: { label: translations.discord, href: 'https://discord.gg/qY662sJK', external: true },
@@ -222,7 +231,10 @@ const defaultLinks: Record<SiteLinkKey, LinkDefinition> = {
222
231
 
223
232
  const groups: Record<LinkGroup, readonly SiteLinkKey[]> = {
224
233
  header: ['home', 'blog', 'support'],
225
- quick: ['downloadClient', 'microsoftStore', 'dockerCompose', 'productDocs', 'blogPosts', 'rss', 'about'],
234
+ quick: [
235
+ 'downloadClient', 'microsoftStore', 'dockerCompose', 'productDocs', 'blogPosts',
236
+ 'rss', 'rssLocale', 'about',
237
+ ],
226
238
  community: ['github', 'discord', 'issueFeedback', 'contactEmail', 'qqGroup'],
227
239
  filings: ['icpFiling', 'publicSecurityFiling'],
228
240
  };
@@ -312,15 +324,21 @@ export function resolveSiteLinks(localeInput?: string | null, options: SiteLinks
312
324
  && options.overrides?.rss?.href === undefined) {
313
325
  return undefined;
314
326
  }
315
- if ((group === 'quick' || group === 'community')
316
- && options.removeLinks?.[group]?.includes(key)) {
317
- return undefined;
318
- }
327
+ if (key === 'rssLocale' && options.rssLocaleFeedUrl === undefined) {
328
+ return undefined;
329
+ }
330
+ if ((group === 'quick' || group === 'community')
331
+ && (options.removeLinks?.[group]?.includes(key)
332
+ || key === 'rssLocale' && options.removeLinks?.quick?.includes('rss'))) {
333
+ return undefined;
334
+ }
319
335
  const override = options.overrides?.[key]
320
336
  ?? (key === 'blogPosts' ? options.overrides?.blog : undefined);
321
337
  const definition = key === 'rss'
322
338
  ? { ...defaultLinks[key], href: options.rssFeedUrl ?? '' }
323
- : defaultLinks[key];
339
+ : key === 'rssLocale'
340
+ ? { ...defaultLinks[key], href: options.rssLocaleFeedUrl ?? '' }
341
+ : defaultLinks[key];
324
342
  return resolveLink(key, locale, definition, override);
325
343
  });
326
344
  const extraLinks = (options.extraLinks?.[group] ?? []).map((entry, index) => {