Fixed footer image path to use aliases

Fixed carousel - added to an init script and re runs on astro page change
This commit is contained in:
Julio Ruiz 2026-02-18 13:07:08 -05:00
parent 435ae4fa05
commit 3b5a4a13d5
5 changed files with 51 additions and 29 deletions

3
.gitignore vendored
View File

@ -14,8 +14,7 @@ pnpm-debug.log*
# environment variables # environment variables
.env .env.keys
.env.production
# macOS-specific files # macOS-specific files
.DS_Store .DS_Store

View File

@ -1,5 +1,5 @@
--- ---
import { Image } from "astro:assets" import { Image } from "astro:assets";
import "swiper/css"; import "swiper/css";
import "swiper/css/navigation"; import "swiper/css/navigation";
import "swiper/css/pagination"; import "swiper/css/pagination";
@ -20,7 +20,11 @@ const { images, class: className } = Astro.props;
{image.text} {image.text}
</div> </div>
)} )}
<img class="w-full h-full object-cover object-center" src={image.image} alt={image.text} /> <img
class="w-full h-full object-cover object-center"
src={image.image}
alt={image.text}
/>
</div> </div>
</div> </div>
)) ))
@ -43,26 +47,35 @@ const { images, class: className } = Astro.props;
<script> <script>
import Swiper from "swiper"; import Swiper from "swiper";
import { Navigation, Pagination, Scrollbar } from 'swiper/modules'; import { Navigation, Pagination, Scrollbar } from "swiper/modules";
const swiper = new Swiper(".swiper", {
// Optional parameters
modules: [Navigation, Pagination, Scrollbar],
loop: true,
// If we need pagination // Re-initialize after every page swap via View Transitions
pagination: { document.addEventListener("astro:after-swap", init);
el: ".swiper-pagination",
},
// Navigation arrows function init() {
navigation: { const swiper = new Swiper(".swiper", {
nextEl: ".swiper-button-next", // Optional parameters
prevEl: ".swiper-button-prev", modules: [Navigation, Pagination, Scrollbar],
}, loop: true,
// And if we need scrollbar // If we need pagination
scrollbar: { pagination: {
el: ".swiper-scrollbar", el: ".swiper-pagination",
}, },
});
// Navigation arrows
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
// And if we need scrollbar
scrollbar: {
el: ".swiper-scrollbar",
},
});
}
// Initialize on the first page load
init();
</script> </script>

View File

@ -1,7 +1,7 @@
--- ---
import { Icon } from "astro-icon/components"; import { Icon } from "astro-icon/components";
import { Image } from "astro:assets"; import { Image } from "astro:assets";
import jbp from "../../assets/DRJBP-1.webp"; import jbp from "@assets/DRJBP-1.webp";
import { createTranslator, t } from '../../i18n'; import { createTranslator, t } from '../../i18n';
const tl = createTranslator(Astro.currentLocale); const tl = createTranslator(Astro.currentLocale);

View File

@ -4,18 +4,19 @@ import { z } from 'astro/zod';
const news = defineCollection({ const news = defineCollection({
loader: glob({ pattern: "**/*.md", base: "./src/content/news" }), loader: glob({ pattern: "**/*.md", base: "./src/content/news" }),
schema: z.object({ schema: ({ image }) => z.object({
locale: z.string(), locale: z.string().describe("News main language"),
title: z.string(), title: z.string(),
date: z.date(), date: z.date(),
draft: z.boolean().optional(),
place: z.string().optional(), place: z.string().optional(),
city: z.string().optional(), city: z.string().optional(),
state: z.string().optional(), state: z.string().optional(),
country: z.string().optional(), country: z.string().optional(),
thumbnail: z.string().optional(), thumbnail: image().optional().describe("Main news thumbnail image"),
youtube: z.string().optional(), youtube: z.string().optional(),
gallery: z.array(z.object({ gallery: z.array(z.object({
image: z.string().optional(), image: image().optional(),
text: z.string().optional() text: z.string().optional()
})).optional().nullable() })).optional().nullable()
}), }),

View File

@ -1,5 +1,14 @@
{ {
"extends": "astro/tsconfigs/strict", "extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"], "include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"] "exclude": ["dist"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@assets/*": ["src/assets/*"],
"@components/*": ["src/components/*"],
"@layouts/*": ["src/layouts/*"]
}
}
} }