Skip to content

Commit ac19727

Browse files
author
Daveed
committed
draft for about/slug
1 parent 9c24608 commit ac19727

File tree

2 files changed

+84
-6
lines changed

2 files changed

+84
-6
lines changed

src/components/blocks.content.astro

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { content, className = "" } = Astro.props;
1313
content && content.length > 0 && (
1414
<div class={`blocks-content ${className}`}>
1515
{content.map((block) => (
16-
<Fragment>
16+
<>
1717
{/* Paragraph blocks */}
1818
{block.type === "paragraph" && (
1919
<p class="mb-4 leading-relaxed">
@@ -291,15 +291,15 @@ const { content, className = "" } = Astro.props;
291291
{((block.image as any).caption ||
292292
(block.image as any).alternativeText ||
293293
(block.image as any).name) && (
294-
<figcaption class="text-center text-sm text-gray-500 mt-3 italic">
294+
<figcaption class="text-center text-sm text-muted mt-3 italic">
295295
{(block.image as any).caption ||
296296
(block.image as any).alternativeText ||
297297
(block.image as any).name}
298298
</figcaption>
299299
)}
300300
</figure>
301301
)}
302-
</Fragment>
302+
</>
303303
))}
304304
</div>
305305
)

src/pages/about/[slug].astro

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,83 @@
11
---
2+
import Layout from "../../layouts/BasicLayout.astro";
3+
import BlocksContent from "../../components/blocks.content.astro";
4+
import { getCollection } from "astro:content";
5+
6+
export async function getStaticPaths() {
7+
const pages = await getCollection("pages");
8+
9+
// Filter pages that should appear under /about
10+
const aboutPages = pages.filter((p) => {
11+
const slug = p.data?.slug || p.id;
12+
if (!slug) return false;
13+
// skip the index/about home or obvious root pages
14+
if (slug === "about" || slug === "home") return false;
15+
const pd = p.data as any;
16+
// skip pages that point to external URLs
17+
if (pd?.ExternalUrl) return false;
18+
// allow an explicit opt-out via ShowInAbout = false
19+
if (pd?.ShowInAbout === false) return false;
20+
// if a Section field exists, only include pages explicitly in the 'about' section
21+
if (pd?.Section && String(pd?.Section).toLowerCase() !== "about")
22+
return false;
23+
return true;
24+
});
25+
26+
return aboutPages.map((p) => ({ params: { slug: p.data?.slug || p.id } }));
27+
}
28+
29+
const pages = await getCollection("pages");
30+
31+
const { slug } = Astro.params;
32+
const current = pages.find((p) => p.data?.slug === slug || p.id === slug);
33+
if (!current) throw new Error(`Page not found: ${slug}`);
34+
35+
const page = current.data;
36+
37+
const storeData = await getCollection("store");
38+
const store = storeData[0]?.data || {};
239
---
3-
<div>
4-
Hola
5-
</div>
40+
41+
<Layout
42+
title={page?.SEO?.metaTitle || page?.Title || "Acerca de Nosotros"}
43+
description={page?.SEO?.metaDescription || undefined}
44+
keywords={page?.SEO?.metaKeywords || undefined}
45+
author={page?.SEO?.metaAuthor || undefined}
46+
ogImage={page?.SEO?.socialImage?.url || undefined}
47+
>
48+
<main>
49+
<!-- Hero -->
50+
<section
51+
class="py-6 bg-gradient"
52+
style="background: linear-gradient(135deg,#f8fafc 0%, #eef2ff 100%);"
53+
>
54+
<div class="container">
55+
<div class="row justify-content-center">
56+
<div class="col-lg-10 text-center">
57+
<h1 class="display-4 fw-bold mb-3">{page?.Title || "Acerca de"}</h1>
58+
{
59+
page?.SEO?.metaDescription ? (
60+
<p class="lead text-muted mb-0">{page.SEO.metaDescription}</p>
61+
) : (
62+
<p class="lead text-muted mb-0">
63+
Conoce más sobre nosotros y lo que hacemos.
64+
</p>
65+
)
66+
}
67+
</div>
68+
</div>
69+
</div>
70+
</section>
71+
72+
<!-- Content Blocks -->
73+
<section class="py-5">
74+
<div class="container">
75+
<div class="row justify-content-center">
76+
<div class="col-lg-10">
77+
<BlocksContent content={page?.Content || []} />
78+
</div>
79+
</div>
80+
</div>
81+
</section>
82+
</main>
83+
</Layout>

0 commit comments

Comments
 (0)