Logo świąteczne, poprawka w SEO, oraz wyszukiwaniu kanałów

This commit is contained in:
dm
2025-12-17 06:11:33 +01:00
parent 4f0f171bdc
commit ce8b627160
11 changed files with 104 additions and 57 deletions

View File

@@ -5,7 +5,10 @@
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview"
"preview": "astro preview",
"clean": "rimraf node_modules .astro .vite dist .cache .turbo package-lock.json",
"fresh": "npm run clean && npm install",
"dev:clean": "npm run clean && npm install && astro dev"
},
"dependencies": {
"@astrojs/node": "^9.5.1",
@@ -26,6 +29,7 @@
"@types/better-sqlite3": "^7.6.13",
"autoprefixer": "^10.4.0",
"postcss": "^8.4.0",
"rimraf": "^6.1.2",
"tailwindcss": "^3.4.0"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/logon.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,20 +1,20 @@
title:
- "Internet i Telewizja FUZ"
- Internet i Telewizja FUZ
subtitle:
- Doskanały internet światłowodowy i telewizja w Wyszkowie i okolicach,
- "Lokalny operator, znamy Twoją okolicę,"
- "Realny serwis, szybkie wsparcie,"
- "Stabilna infrastruktura światłowodowa,"
- Doskonały internet światłowodowy i telewizja w Wyszkowie i okolicach,
- Lokalny operator, znamy Twoją okolicę,
- Realny serwis, szybkie wsparcie,
- Stabilna infrastruktura światłowodowa,
description: |
imageUrl: "home.webp"
imageUrl: home.webp
ctas:
- label: "Zobacz ofertę Internetu"
href: "/internet-swiatlowodowy"
title: "Przejdź do oferty Internetu światłowodowego"
- label: Zobacz ofertę Internetu
href: /internet-swiatlowodowy
title: Przejdź do oferty Internetu światłowodowego
primary: false
- label: "Zobacz ofertę Telewizji"
href: "/internet-telewizja"
title: "Przejdź do oferty Internet + Telewizja w FUZ"
- label: Zobacz ofertę Telewizji
href: /internet-telewizja
title: Przejdź do oferty Internet + Telewizja w FUZ
primary: false

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -126,17 +126,34 @@ export default function JamboxChannelsSearch() {
setWanted([]);
}
// =========================================
// ✅ sugestie pakietów dla koszyka
// - GŁÓWNE: exact/ranked (z count)
// - TEMATYCZNE: dodatki do dokupienia (bez liczenia)
// =========================================
const packageSuggestions = useMemo(() => {
if (!wanted.length) return { exact: [], ranked: [], thematic: [] };
if (!wanted.length) return { exact: [], ranked: [], thematic: [], baseWantedLen: 0, wantedLen: 0 };
// ✅ kanały, które mają pakiety główne (tylko te liczymy w dopasowaniu "głównych")
const baseWanted = wanted.filter((ch) => Array.isArray(ch.packages) && ch.packages.length > 0);
const baseWantedLen = baseWanted.length;
// ======= GŁÓWNE =======
// jeśli nie ma żadnego kanału "bazowego", nie ma co liczyć dopasowania bazowych
if (baseWantedLen === 0) {
// nadal zwracamy tematyczne
const thematicMap = new Map();
for (const ch of wanted) {
const tp = Array.isArray(ch.thematic_packages) ? ch.thematic_packages : [];
for (const p of tp) {
const tid = String(p?.tid ?? "").trim();
const name = String(p?.name ?? "").trim();
if (!tid || !name) continue;
if (!thematicMap.has(tid)) thematicMap.set(tid, { tid, name });
}
}
const thematic = Array.from(thematicMap.values()).sort((a, b) => a.name.localeCompare(b.name, "pl"));
return { exact: [], ranked: [], thematic, baseWantedLen, wantedLen: wanted.length };
}
const counts = new Map(); // key = packageName
for (const ch of wanted) {
for (const ch of baseWanted) {
const pkgs = Array.isArray(ch.packages) ? ch.packages : [];
for (const p of pkgs) {
const name = String(p?.name ?? "").trim();
@@ -150,20 +167,18 @@ export default function JamboxChannelsSearch() {
const all = Array.from(counts.values());
const exact = all
.filter((p) => p.count === wanted.length)
.filter((p) => p.count === baseWantedLen)
.sort((a, b) => a.name.localeCompare(b.name, "pl"));
const ranked = all
.filter((p) => p.count < wanted.length)
.filter((p) => p.count < baseWantedLen)
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name, "pl"))
.slice(0, 12);
// ======= TEMATYCZNE (dodatki) =======
const thematicMap = new Map(); // key = tid
for (const ch of wanted) {
const tp = Array.isArray(ch.thematic_packages)
? ch.thematic_packages
: [];
const tp = Array.isArray(ch.thematic_packages) ? ch.thematic_packages : [];
for (const p of tp) {
const tid = String(p?.tid ?? "").trim();
const name = String(p?.name ?? "").trim();
@@ -176,9 +191,10 @@ export default function JamboxChannelsSearch() {
a.name.localeCompare(b.name, "pl")
);
return { exact, ranked, thematic };
return { exact, ranked, thematic, baseWantedLen, wantedLen: wanted.length };
}, [wanted]);
return (
<div class="f-chsearch">
<h1 class="f-section-title">Wyszukiwanie kanałów w pakietach telewizji</h1>
@@ -260,7 +276,7 @@ export default function JamboxChannelsSearch() {
onClick={() => scrollToPackage(p.name)}
title={`Zawiera ${p.count}/${wanted.length} wybranych kanałów`}
>
{p.name} ({p.count}/{wanted.length})
{p.name} ({p.count}/{packageSuggestions.baseWantedLen})
</button>
))}
</div>

View File

@@ -4,54 +4,80 @@ import fs from "fs";
const seo = Astro.props.seo ?? {};
const globalSeo = yaml.load(
fs.readFileSync("./src/content/home/seo.yaml", "utf8")
fs.readFileSync("./src/content/home/seo.yaml", "utf8"),
);
const { site, company } = globalSeo;
const page = seo.page ?? {};
// ===== helpers =====
function stripTrailingSlash(s = "") {
return String(s).replace(/\/$/, "");
}
function stripLeadingSlash(s = "") {
return String(s).replace(/^\//, "");
}
function isAbsoluteUrl(s = "") {
return /^https?:\/\//i.test(String(s));
}
function joinUrl(base = "", path = "") {
const b = stripTrailingSlash(base);
const p = String(path || "");
if (!p) return b;
if (isAbsoluteUrl(p)) return p;
return `${b}/${stripLeadingSlash(p)}`;
}
// ===== origin / base for meta =====
// Astro.url.origin daje aktualny host (test/prod) dokładnie to chcemy do OG/WhatsApp
const origin = Astro.url?.origin || site.url;
const baseUrl = stripTrailingSlash(origin);
// ===== page fields =====
const title = page.title ?? site.name;
const description = page.description ?? site.description;
const image = page.image ?? site.logo;
const canonical = site.url + (page.url ?? "/");
const rawImage = page.image ?? site.logo;
const image = joinUrl(baseUrl, rawImage);
const canonical = joinUrl(baseUrl, page.url ?? "/");
const keywords = page.keywords ?? [];
const extraSchema = page.schema ?? null;
// JSON-LD objects
// JSON-LD objects (tu też używamy baseUrl, żeby nie rozjeżdżało się między test/prod)
const schemaWebsite = {
"@context": "https://schema.org",
"@type": "WebSite",
"url": site.url,
"name": site.name,
"potentialAction": {
url: baseUrl,
name: site.name,
potentialAction: {
"@type": "SearchAction",
"target": `${site.url}/wyszukiwarka?query={search_term_string}`,
"query-input": "required name=search_term_string"
}
target: `${baseUrl}/wyszukiwarka?query={search_term_string}`,
"query-input": "required name=search_term_string",
},
};
const schemaLocalBusiness = {
"@context": "https://schema.org",
"@type": "LocalBusiness",
"name": company.name,
"image": site.url + company.logo,
"telephone": company.phone,
"email": company.email,
"address": {
name: company.name,
image: joinUrl(baseUrl, company.logo),
telephone: company.phone,
email: company.email,
address: {
"@type": "PostalAddress",
"streetAddress": company.street,
"addressLocality": company.city,
"postalCode": company.postal,
"addressCountry": company.country
streetAddress: company.street,
addressLocality: company.city,
postalCode: company.postal,
addressCountry: company.country,
},
"geo": {
geo: {
"@type": "GeoCoordinates",
"latitude": company.lat,
"longitude": company.lon
latitude: company.lat,
longitude: company.lon,
},
"url": site.url
url: baseUrl,
};
// JSON strings
@@ -67,9 +93,7 @@ const jsonExtra = extraSchema ? JSON.stringify(extraSchema) : null;
<title>{title}</title>
<meta name="description" content={description} />
{keywords.length > 0 && (
<meta name="keywords" content={keywords.join(", ")} />
)}
{keywords.length > 0 && <meta name="keywords" content={keywords.join(", ")} />}
<link rel="canonical" href={canonical} />
@@ -79,7 +103,12 @@ const jsonExtra = extraSchema ? JSON.stringify(extraSchema) : null;
<meta property="og:description" content={description} />
<meta property="og:url" content={canonical} />
<meta property="og:site_name" content={site.name} />
<meta property="og:image" content={image} />
<meta property="og:image:secure_url" content={image} />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
@@ -94,9 +123,7 @@ const jsonExtra = extraSchema ? JSON.stringify(extraSchema) : null;
<script type="application/ld+json" set:html={jsonBusiness}></script>
<!-- JSON-LD: Extra schema -->
{jsonExtra && (
<script type="application/ld+json" set:html={jsonExtra}></script>
)}
{jsonExtra && <script type="application/ld+json" set:html={jsonExtra}></script>}
<slot />
</head>