Dodanie Title i Description strony do yamli oraz jezeli nie ma seo to do strony
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# tytuł dokumentu jednoczesnie tytułem strony <title></title>
|
||||
title: "Polityka Prywatności"
|
||||
# opis wstawiany w <meta name="description" content=""
|
||||
description: Polityka prywatności, opisuje zasady ochrony Twoich danych osobowych.
|
||||
visible: true
|
||||
intro: Polityka prywatności, opisuje zasady ochrony Twoich danych osobowych.
|
||||
content: |
|
||||
## §1. Informacje podstawowe.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: "Promocja świąteczna"
|
||||
description: Przykładowo gdybysmy dodali promocję do dokumentów
|
||||
visible: true
|
||||
intro: Przykładowo gdybysmy dodali promocję do dokumentów
|
||||
content: |
|
||||
Jeśli kupujesz w sklepach internetowych, prawdopodobnie co pewien czas natykasz się na opisy, które nie zachęcają do zakupów.
|
||||
Do najczęściej powtarzanych błędów opisów produktów należą:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
title: Możliwości telewizji JAMBOX
|
||||
description: Funkcje i udogodnienia dostępne w JAMBOX.
|
||||
sections:
|
||||
- title: CatchUp - Archiwum TV
|
||||
image: https://www.jambox.pl/sites/default/files/jambox-kyanit-catchup1.png
|
||||
|
||||
@@ -46,6 +46,7 @@ export default function JamboxMozliwosciSearch({ items = [] }) {
|
||||
<div className="f-chsearch__top">
|
||||
<div className="f-chsearch__inputwrap">
|
||||
<input
|
||||
name="search"
|
||||
className="f-chsearch__input"
|
||||
type="search"
|
||||
value={search.query}
|
||||
|
||||
@@ -11,13 +11,44 @@ import Cookie from "../islands/Cookie.jsx";
|
||||
|
||||
import rawCookie from "../content/site/cookie.yaml?raw";
|
||||
const cookieCfg = yaml.parse(rawCookie);
|
||||
const { seo } = Astro.props;
|
||||
|
||||
// ✅ Pobierz wszystkie możliwe props
|
||||
const {
|
||||
seo, // Pełny obiekt SEO (stary sposób)
|
||||
title, // Indywidualny title (nowy sposób)
|
||||
description, // Indywidualny description (nowy sposób)
|
||||
image, // Opcjonalny image
|
||||
keywords, // Opcjonalne keywords
|
||||
url, // Opcjonalny url
|
||||
} = Astro.props;
|
||||
|
||||
// ✅ PRIORYTET: title/description → seo → undefined
|
||||
let finalSeo;
|
||||
|
||||
// Jeśli mamy indywidualne pola (title lub description) - użyj ich
|
||||
if (title || description) {
|
||||
finalSeo = {
|
||||
page: {
|
||||
title,
|
||||
description,
|
||||
image,
|
||||
keywords,
|
||||
url,
|
||||
},
|
||||
};
|
||||
}
|
||||
// Jeśli nie ma indywidualnych, ale jest seo object - użyj go
|
||||
else if (seo) {
|
||||
finalSeo = seo;
|
||||
}
|
||||
// Jeśli nic nie ma - undefined (użyje global defaults z BaseHead)
|
||||
else {
|
||||
finalSeo = undefined;
|
||||
}
|
||||
---
|
||||
|
||||
<html lang="pl" class="scroll-smooth">
|
||||
<head>
|
||||
<BaseHead seo={seo} />
|
||||
</head>
|
||||
<BaseHead seo={finalSeo} />
|
||||
|
||||
<body class="min-h-screen flex flex-col">
|
||||
<Header />
|
||||
|
||||
@@ -4,14 +4,15 @@ import yaml from "js-yaml";
|
||||
|
||||
export type DocYaml = {
|
||||
title: string;
|
||||
description: string;
|
||||
visible?: boolean;
|
||||
intro?: string;
|
||||
content: string;
|
||||
};
|
||||
|
||||
export type DocEntry = DocYaml & {
|
||||
slug: string;
|
||||
file: string;
|
||||
description: string;
|
||||
};
|
||||
|
||||
const DOCS_DIR = path.join(process.cwd(), "src", "content", "document");
|
||||
@@ -34,13 +35,14 @@ export function listDocuments(): DocEntry[] {
|
||||
|
||||
if (!data.title || typeof data.title !== "string") continue;
|
||||
if (!data.content || typeof data.content !== "string") continue;
|
||||
if (!data.description || typeof data.description !== "string") continue;
|
||||
|
||||
items.push({
|
||||
slug,
|
||||
file,
|
||||
title: data.title,
|
||||
description: data.description,
|
||||
visible: data.visible ?? false,
|
||||
intro: data.intro ?? "",
|
||||
content: data.content,
|
||||
});
|
||||
}
|
||||
@@ -60,14 +62,15 @@ export function getDocumentBySlug(slug: string): DocEntry | null {
|
||||
|
||||
if (!data.title || typeof data.title !== "string") return null;
|
||||
if (!data.content || typeof data.content !== "string") return null;
|
||||
if (!data.description || typeof data.description !== "string") continue;
|
||||
|
||||
return {
|
||||
slug,
|
||||
file,
|
||||
title: data.title,
|
||||
visible: data.visible ?? false,
|
||||
intro: data.intro ?? "",
|
||||
content: data.content,
|
||||
description: data.description,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ if (!doc || doc.visible !== true) {
|
||||
const html = marked.parse(doc.content);
|
||||
---
|
||||
|
||||
<DefaultLayout title={doc.title}>
|
||||
<DefaultLayout title={doc.title} description={doc.description}>
|
||||
<section class="f-section">
|
||||
<div class="f-section-grid-single">
|
||||
<a href="/dokumenty" class="f-document-link">
|
||||
|
||||
@@ -12,6 +12,8 @@ type YamlSection = {
|
||||
};
|
||||
|
||||
type YamlData = {
|
||||
title?: string;
|
||||
description?: string;
|
||||
sections?: YamlSection[];
|
||||
};
|
||||
|
||||
@@ -22,10 +24,16 @@ let items: Array<{
|
||||
content: string;
|
||||
}> = [];
|
||||
|
||||
let pageTitle = "";
|
||||
let pageDescription = "";
|
||||
let err = "";
|
||||
|
||||
try {
|
||||
const data = loadYaml<YamlData>("./src/content/internet-telewizja/telewizja-mozliwosci.yaml");
|
||||
const data = loadYaml<YamlData>(
|
||||
"./src/content/internet-telewizja/telewizja-mozliwosci.yaml",
|
||||
);
|
||||
pageTitle = data?.title || pageTitle;
|
||||
pageDescription = data?.description || pageDescription;
|
||||
const sections = safeArray<YamlSection>(data?.sections);
|
||||
|
||||
items = sections
|
||||
@@ -42,7 +50,7 @@ try {
|
||||
}
|
||||
---
|
||||
|
||||
<DefaultLayout title="Możliwości JAMBOX">
|
||||
<DefaultLayout title={pageTitle} description={pageDescription}>
|
||||
<section class="f-section" id="top">
|
||||
<div class="f-section-grid-single">
|
||||
<h1 class="f-section-title">Możliwości JAMBOX</h1>
|
||||
|
||||
@@ -28,7 +28,7 @@ const seo = loadYaml("./src/content/mapa-zasiegu/seo.yaml");
|
||||
class="w-full md:w-[340px] bg-[var(--f-background)] text-[var(--f-text)]
|
||||
pt-6 px-6 flex flex-col gap-6 overflow-y-auto z-40"
|
||||
>
|
||||
<h3 class="text-3xl">Sprawdź dostępność usług</h3>
|
||||
<h1 class="text-3xl">Sprawdź dostępność usług</h1>
|
||||
<p class="text-sm">
|
||||
Wybierz swoją miejscowość i ulicę oraz numer budynku, aby sprawdzić
|
||||
dostępność usług światłowodowych FUZ.
|
||||
|
||||
Reference in New Issue
Block a user