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