astro - uspojnienie stron, seo unifikacja, favicon
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
---
|
||||
import path from "node:path";
|
||||
|
||||
import DefaultLayout from "../../layouts/DefaultLayout.astro";
|
||||
import SectionRenderer from "../../components/sections/SectionRenderer.astro";
|
||||
import InternetCards from "../../islands/Internet/InternetCards.jsx";
|
||||
|
||||
import { loadYamlFile } from "../../lib/loadYaml";
|
||||
|
||||
type SeoYaml = any;
|
||||
import { loadYaml, safeArray } from "../../lib/astro-helpers";
|
||||
import NoteAccordion from "../../components/ui/NoteAccordion.astro";
|
||||
|
||||
type InternetParam = { klucz: string; label: string; value: string | number };
|
||||
type InternetCena = {
|
||||
@@ -55,65 +51,6 @@ type Addon = {
|
||||
};
|
||||
type AddonsYaml = { cena_opis?: string; dodatki?: Addon[] };
|
||||
|
||||
const seo = loadYamlFile<SeoYaml>(
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"seo.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const data = loadYamlFile<InternetCardsYaml>(
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"cards.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const phoneData = loadYamlFile<PhoneCardsYaml>(
|
||||
path.join(process.cwd(), "src", "content", "telefon", "cards.yaml"),
|
||||
);
|
||||
|
||||
const addonsData = loadYamlFile<AddonsYaml>(
|
||||
path.join(
|
||||
process.cwd(),
|
||||
"src",
|
||||
"content",
|
||||
"internet-swiatlowodowy",
|
||||
"addons.yaml",
|
||||
),
|
||||
);
|
||||
|
||||
const tytul = data?.tytul ?? "";
|
||||
const opis = data?.opis ?? "Wybierz rodzaj budynku i czas trwania umowy";
|
||||
const uwaga = data?.uwaga ?? "";
|
||||
|
||||
const waluta = data?.waluta ?? "PLN";
|
||||
const cenaOpis = data?.cena_opis ?? "zł/mies.";
|
||||
|
||||
const cards = (
|
||||
Array.isArray(data?.cards)
|
||||
? data.cards.filter((c) => c?.widoczny === true)
|
||||
: []
|
||||
) as InternetCard[];
|
||||
|
||||
const phoneCards = (
|
||||
Array.isArray(phoneData?.cards)
|
||||
? phoneData.cards.filter((c) => c?.widoczny === true)
|
||||
: []
|
||||
) as PhoneCard[];
|
||||
|
||||
const addons = (
|
||||
Array.isArray(addonsData?.dodatki) ? addonsData.dodatki : []
|
||||
) as Addon[];
|
||||
|
||||
const addonsCenaOpis = addonsData?.cena_opis ?? cenaOpis;
|
||||
|
||||
type SwitchOption = { id: string | number; nazwa: string };
|
||||
type SwitchDef = {
|
||||
id: string;
|
||||
@@ -124,13 +61,32 @@ type SwitchDef = {
|
||||
};
|
||||
type SwitchesYaml = { switches?: SwitchDef[] };
|
||||
|
||||
const switchesData = loadYamlFile<SwitchesYaml>(
|
||||
path.join(process.cwd(), "src", "content", "site", "switches.yaml"),
|
||||
const seo = loadYaml("./src/content/internet-swiatlowodowy/seo.yaml");
|
||||
const data = loadYaml<InternetCardsYaml>(
|
||||
"./src/content/internet-swiatlowodowy/cards.yaml",
|
||||
);
|
||||
const phoneData = loadYaml<PhoneCardsYaml>("./src/content/telefon/cards.yaml");
|
||||
const addonsData = loadYaml<AddonsYaml>(
|
||||
"./src/content/internet-swiatlowodowy/addons.yaml",
|
||||
);
|
||||
const switchesData = loadYaml<SwitchesYaml>("./src/content/site/switches.yaml");
|
||||
|
||||
const switches = (
|
||||
Array.isArray(switchesData?.switches) ? switchesData.switches : []
|
||||
) as SwitchDef[];
|
||||
const tytul = data?.tytul ?? "";
|
||||
const opis = data?.opis ?? "Wybierz rodzaj budynku i czas trwania umowy";
|
||||
const uwaga = data?.uwaga ?? "";
|
||||
const waluta = data?.waluta ?? "PLN";
|
||||
const cenaOpis = data?.cena_opis ?? "zł/mies.";
|
||||
|
||||
const cards = safeArray<InternetCard>(data?.cards).filter(
|
||||
(c) => c?.widoczny === true,
|
||||
);
|
||||
const phoneCards = safeArray<PhoneCard>(phoneData?.cards).filter(
|
||||
(c) => c?.widoczny === true,
|
||||
);
|
||||
const addons = safeArray<Addon>(addonsData?.dodatki);
|
||||
const switches = safeArray<SwitchDef>(switchesData?.switches);
|
||||
|
||||
const addonsCenaOpis = addonsData?.cena_opis ?? cenaOpis;
|
||||
---
|
||||
|
||||
<DefaultLayout seo={seo}>
|
||||
@@ -149,7 +105,7 @@ const switches = (
|
||||
addonsCenaOpis={addonsCenaOpis}
|
||||
switches={switches}
|
||||
/>
|
||||
<p><span class="f-card-price text-sm">* </span>{uwaga}</p>
|
||||
<NoteAccordion text={uwaga} star={true} />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user