@levino/shipyard-base 0.3.0 → 0.4.0
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.
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { Footer as FooterComponent } from "../components";
|
|
3
|
+
import config from "virtual:shipyard/config";
|
|
3
4
|
|
|
4
|
-
const locale = Astro.currentLocale;
|
|
5
|
+
const locale = Astro.currentLocale || config.defaultLocale;
|
|
6
|
+
|
|
7
|
+
const withLocale = (path: string) =>
|
|
8
|
+
locale === config.defaultLocale ? path : `/${locale}${path}`;
|
|
5
9
|
---
|
|
6
10
|
|
|
7
11
|
<FooterComponent
|
|
8
|
-
links={[{ href:
|
|
12
|
+
links={[{ href: withLocale("/imprint"), label: "Impressum" }]}
|
|
9
13
|
copyright={{
|
|
10
14
|
href: "https://github.com/levino",
|
|
11
15
|
label: "Levin Keller",
|
package/astro/layouts/Page.astro
CHANGED
|
@@ -18,16 +18,16 @@ type Props = {
|
|
|
18
18
|
sidebarNavigation?: NavigationTree;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const currentLocale = Astro.currentLocale || config.defaultLocale;
|
|
22
22
|
const currentPath = Astro.url.pathname;
|
|
23
23
|
const props = Astro.props.frontmatter || Astro.props;
|
|
24
24
|
|
|
25
|
-
const withLocale = (
|
|
26
|
-
|
|
25
|
+
const withLocale = (path: string) =>
|
|
26
|
+
currentLocale === config.defaultLocale ? path : `/${currentLocale}${path}`;
|
|
27
27
|
const applyLocaleAndSetActive: (navigation: NavigationTree) => NavigationTree =
|
|
28
28
|
mapObjIndexed((entry: NavigationEntry) => ({
|
|
29
29
|
...entry,
|
|
30
|
-
...(entry.href ? { href:
|
|
30
|
+
...(entry.href ? { href: withLocale(entry.href) } : {}),
|
|
31
31
|
active: entry.href === currentPath,
|
|
32
32
|
...(entry.subEntry
|
|
33
33
|
? { subEntry: applyLocaleAndSetActive(entry.subEntry) }
|
|
@@ -35,8 +35,7 @@ const applyLocaleAndSetActive: (navigation: NavigationTree) => NavigationTree =
|
|
|
35
35
|
}));
|
|
36
36
|
|
|
37
37
|
const navigation = applyLocaleAndSetActive(config.navigation);
|
|
38
|
-
const title =
|
|
39
|
-
|
|
38
|
+
const title = `${config.title} - ${props.title}`;
|
|
40
39
|
---
|
|
41
40
|
|
|
42
41
|
<html>
|
|
@@ -44,9 +43,7 @@ const title = `${config.title} - ${props.title}`
|
|
|
44
43
|
<meta charset="utf-8" />
|
|
45
44
|
<link rel="sitemap" href="/sitemap-index.xml" />
|
|
46
45
|
<title>
|
|
47
|
-
{
|
|
48
|
-
title
|
|
49
|
-
}
|
|
46
|
+
{title}
|
|
50
47
|
</title>
|
|
51
48
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
52
49
|
<meta name="description" content={props.description} />
|