@levino/shipyard-base 0.5.0 → 0.5.2
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/astro/layouts/Footer.astro +2 -6
- package/astro/layouts/Page.astro +18 -1
- package/package.json +1 -1
- package/src/schemas/config.ts +14 -0
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
import config from 'virtual:shipyard/config'
|
|
3
2
|
import { Footer as FooterComponent } from '../components'
|
|
4
3
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
const withLocale = (path: string) =>
|
|
8
|
-
locale === config.defaultLocale ? path : `/${locale}${path}`
|
|
4
|
+
const withLocale = (path: string) => `/${Astro.currentLocale}${path}`
|
|
9
5
|
---
|
|
10
6
|
|
|
11
7
|
<FooterComponent
|
|
@@ -13,6 +9,6 @@ const withLocale = (path: string) =>
|
|
|
13
9
|
copyright={{
|
|
14
10
|
href: "https://github.com/levino",
|
|
15
11
|
label: "Levin Keller",
|
|
16
|
-
year:
|
|
12
|
+
year: 2025,
|
|
17
13
|
}}
|
|
18
14
|
/>
|
package/astro/layouts/Page.astro
CHANGED
|
@@ -3,7 +3,11 @@ import Footer from './Footer.astro'
|
|
|
3
3
|
import '../../src/globals.css'
|
|
4
4
|
import config from 'virtual:shipyard/config'
|
|
5
5
|
import { mapObjIndexed } from 'ramda'
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
NavigationEntry,
|
|
8
|
+
NavigationTree,
|
|
9
|
+
Script,
|
|
10
|
+
} from '../../src/schemas/config'
|
|
7
11
|
import { getTitle } from '../../src/tools/title'
|
|
8
12
|
import { GlobalDesktopNavigation, SidebarNavigation } from '../components'
|
|
9
13
|
|
|
@@ -35,6 +39,14 @@ const applyLocaleAndSetActive: (navigation: NavigationTree) => NavigationTree =
|
|
|
35
39
|
|
|
36
40
|
const navigation = applyLocaleAndSetActive(config.navigation)
|
|
37
41
|
const title = getTitle(config.title, props.title)
|
|
42
|
+
|
|
43
|
+
// Helper function to render script attributes
|
|
44
|
+
const renderScriptAttributes = (script: Script) => {
|
|
45
|
+
if (typeof script === 'string') {
|
|
46
|
+
return { src: script }
|
|
47
|
+
}
|
|
48
|
+
return script
|
|
49
|
+
}
|
|
38
50
|
---
|
|
39
51
|
|
|
40
52
|
<html>
|
|
@@ -48,6 +60,11 @@ const title = getTitle(config.title, props.title)
|
|
|
48
60
|
<meta name="description" content={props.description} />
|
|
49
61
|
<meta property="og:title" content={title} />
|
|
50
62
|
<meta property="og:description" content={props.description} />
|
|
63
|
+
|
|
64
|
+
{config.scripts?.map((script) => {
|
|
65
|
+
const attrs = renderScriptAttributes(script)
|
|
66
|
+
return <script is:inline {...attrs}></script>
|
|
67
|
+
})}
|
|
51
68
|
</head>
|
|
52
69
|
<body>
|
|
53
70
|
<div class="drawer lg:drawer-open">
|
package/package.json
CHANGED
package/src/schemas/config.ts
CHANGED
|
@@ -9,11 +9,25 @@ export interface NavigationEntry {
|
|
|
9
9
|
|
|
10
10
|
export type NavigationTree = Record<string, NavigationEntry>
|
|
11
11
|
|
|
12
|
+
export interface ScriptConfig {
|
|
13
|
+
src: string
|
|
14
|
+
async?: boolean
|
|
15
|
+
defer?: boolean
|
|
16
|
+
type?: string
|
|
17
|
+
crossorigin?: string
|
|
18
|
+
integrity?: string
|
|
19
|
+
referrerpolicy?: string
|
|
20
|
+
[key: string]: string | boolean | undefined
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type Script = string | ScriptConfig
|
|
24
|
+
|
|
12
25
|
export interface Config {
|
|
13
26
|
brand: string
|
|
14
27
|
navigation: NavigationTree
|
|
15
28
|
title: string
|
|
16
29
|
tagline: string
|
|
30
|
+
scripts?: Script[]
|
|
17
31
|
}
|
|
18
32
|
|
|
19
33
|
export interface FinalConfig extends Config {
|