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
.env
.env.production
.env.keys
# macOS-specific files
.DS_Store

View File

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

View File

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

View File

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

View File

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