Closed michaelrambeau closed 6 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
javascript-risingstars | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jan 17, 2024 2:23am |
Goal
Improve the performance of the brand new version powered by Astro by:
Also, the opacity of the categories is changed during the loading to provide a better visual feedback.
Strategy
To make the Ajax request faster when loading content, we pre-render all of them at build time. That means using path parameters
/[year]/[language]/[category]
instead of query string parameters for Astro partials.Also, to avoid having to build partials for the whole categories and for the extra projects displayed when pushing the "Show more" button, we combine both HTML in the same partial and use htmx hx-select to pick the relevant part, either the whole category or the extra projects
hx-select="section"
(because categories are rendered inside<section>
tags)hx-select=".extra-projects"
So now we have only one partial, in
/[year]/[language]/[category].astro
, with the following markup:How to test
Inside a given category, switch between years, using the Previous / Next buttons and the dropdown: it should be fast and you should notice the change of opacity.
Scroll down:
Mobile
section) are loaded eagerly