Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ export default defineConfig({
format: "directory",
},
vite: {
server: {
watch: {
// Locale worktrees and scratch folders hold hundreds of thousands of
// files (full dist builds); watching them makes dev startup take minutes.
ignored: ["**/.worktrees/**", "**/.tmp-*/**"],
},
},
build: {
rolldownOptions: {
// Astro injects "use astro:head-inject" into every MDX module; rolldown
Expand All @@ -90,6 +97,12 @@ export default defineConfig({
"/de/features/external-control": "/de/external-limit",
"/en/integrations/home-assistant": "/en/smarthome/home-assistant",
"/de/integrations/home-assistant": "/de/smarthome/home-assistant",
...Object.fromEntries(
LANGS.map((l) => [
`/${l}/installation/considerations`,
`/${l}/buyers-guide`,
]),
),
},
integrations: [
mermaid({
Expand Down Expand Up @@ -178,14 +191,19 @@ export default defineConfig({
"Supported devices (chargers, meters, vehicles, tariffs) are listed in https://docs.evcc.io/llms-devices.txt.",
// Bundles and index stay English; other locales keep their .md routes.
exclude: LANGS.filter((l) => l !== "en").map((l) => `${l}/**`),
promote: ["en", "en/installation/**", "en/features/**"],
promote: [
"en",
"en/installation/**",
"en/buyers-guide",
"en/features/**",
],
demote: ["en/reference/cli/**", "en/media", "en/blog/**"],
subsets: [
{
label: "Installation",
description:
"installing and initial setup on Linux, Raspberry Pi, Docker, Home Assistant, macOS, Windows",
paths: ["en/installation/**"],
"choosing hardware and devices, installing and initial setup on Linux, Raspberry Pi, Docker, Home Assistant, macOS, Windows",
paths: ["en/installation/**", "en/buyers-guide"],
},
{
label: "Features",
Expand Down Expand Up @@ -250,12 +268,32 @@ export default defineConfig({
{
...label("installation"),
items: [
{ autogenerate: { directory: "installation", collapsed: true } },
{ slug: "installation" },
{
...label("hardware"),
collapsed: true,
items: [
{ ...label("overview"), slug: "installation/hardware" },
{ autogenerate: { directory: "installation/hardware" } },
],
},
...[
"linux-image",
"docker",
"home-assistant",
"proxmox",
"linux",
"macos",
"freebsd",
"windows",
"configuration",
].map((page) => ({ slug: `installation/${page}` })),
],
},
{
...label("devices"),
items: [
{ ...label("buyersGuide"), slug: "buyers-guide" },
{
...label("chargers"),
link: "/chargers",
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@astrojs/mdx": "^8.0.3",
"@astrojs/sitemap": "^3.7.2",
"@astrojs/starlight": "^0.42.2",
"@evcc/icons": "^0.5.11",
"@evcc/icons": "^0.5.15",
"astro": "^7.0.6",
"astro-mermaid": "^2.0.1",
"hast-util-select": "^6.0.4",
Expand Down
3 changes: 2 additions & 1 deletion scripts/i18n/batches.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const CORE = [
[
"index",
"installation/index",
"installation/considerations",
"installation/hardware",
"buyers-guide",
"installation/configuration",
],
],
Expand Down
28 changes: 24 additions & 4 deletions src/components/CtaButton.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
---
interface Props {
href: string;
/** without a link the button is shown inactive, e.g. for something that is not available yet */
href?: string;
/** full-size button aligned with the text instead of centred */
align?: "center" | "start";
}

const { href } = Astro.props;
const { href, align = "center" } = Astro.props;
// links that leave the docs, e.g. to a shop, open in a new tab
const external = href && /^https?:/.test(href) ? { target: "_blank", rel: "noopener" } : {};
---

<div class="cta-container">
<a class="cta-button" href={href}><slot /></a>
<div class:list={["cta-container", { "cta-start": align === "start" }]}>
{href ? (
<a class="cta-button" href={href} {...external}><slot /></a>
) : (
<span class="cta-button cta-inactive"><slot /></span>
)}
</div>

<style>
Expand All @@ -30,6 +39,17 @@ const { href } = Astro.props;
.cta-button:hover {
background-color: #076f20;
}
.cta-button.cta-inactive,
.cta-button.cta-inactive:hover,
:global([data-theme="dark"]) .cta-button.cta-inactive {
background-color: var(--sl-color-gray-5);
color: var(--sl-color-gray-2);
cursor: default;
}
.cta-start {
text-align: start;
margin: 2rem 0 1.25rem;
}
:global([data-theme="dark"]) .cta-button {
background-color: #0fdd42;
color: #00002d;
Expand Down
9 changes: 9 additions & 0 deletions src/components/ExternalLinks.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
// Opens every external link in its content in a new tab, e.g. a list of shops.
const html = (await Astro.slots.render("default")).replaceAll(
'<a href="http',
'<a target="_blank" rel="noopener" href="http',
);
---

<Fragment set:html={html} />
60 changes: 60 additions & 0 deletions src/components/IconBanner.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
// Row of evcc device icons on a plate, e.g. below a section heading.
// Illustration only: the icons carry no labels and are hidden from screen readers.
import { deviceIconSvg } from "@utils/deviceIcon";

interface Props {
/** evcc device icons as "<list>/<device>", e.g. "meters/shelly-pro-em", or the markup of an SVG file imported with ?raw */
icons: string[];
/** icons per row; by default all icons share one row */
columns?: number;
/** for icons that are wider than tall, e.g. vehicles: trims the empty space above and below */
wide?: boolean;
}

const { columns, wide = false } = Astro.props;

const svgs = (
await Promise.all(
Astro.props.icons.map((icon) => {
if (icon.trimStart().startsWith("<")) return icon;
const [list = "", slug = ""] = icon.split("/");
return deviceIconSvg(list, slug);
}),
)
).filter(Boolean);
---

<div
class:list={["icon-banner", "not-content", { "icon-banner-wide": wide }]}
aria-hidden="true"
style={`--icon-banner-columns: ${columns ?? svgs.length}`}
>
{svgs.map((svg) => <div class="icon-banner-item" set:html={svg} />)}
</div>

<style>
.icon-banner {
display: grid;
grid-template-columns: repeat(var(--icon-banner-columns), minmax(0, 5.5rem));
justify-content: space-around;
gap: 0.5rem 1rem;
margin: 1.25rem 0;
padding: 1rem 1.5rem;
border-radius: 1rem;
background: var(--evcc-photo-bg);
}
.icon-banner-item :global(svg) {
display: block;
width: 100%;
height: auto;
}
/* the icons are square; show only their middle band */
.icon-banner-wide .icon-banner-item {
aspect-ratio: 2 / 1;
overflow: hidden;
}
.icon-banner-wide .icon-banner-item :global(svg) {
margin-top: -25%;
}
</style>
9 changes: 4 additions & 5 deletions src/components/MobileBreadcrumbs.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,10 @@ const section: Crumb = isBlog
: { label: Astro.locals.t("site.docsLabel"), href: locale ? `/${locale}` : "/" };

const hit = isBlog ? null : find(sidebar, [], null);
const crumbs: Crumb[] = [
section,
...(hit ? [...hit.trail, ...(hit.href === path ? [] : [{ label: hit.label, href: hit.href }])] : []),
...(path === section.href ? [] : [{ label: entry.data.title }]),
];
const trail: Crumb[] = hit ? [...hit.trail, ...(hit.href === path ? [] : [{ label: hit.label, href: hit.href }])] : [];
// a group named like its overview page would show the same label twice
if (trail.at(-1)?.label === entry.data.title) trail.pop();
const crumbs: Crumb[] = [section, ...trail, ...(path === section.href ? [] : [{ label: entry.data.title }])];
const last = crumbs.length - 1;
---

Expand Down
Loading