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