⚡ Optimize navbar superuser social links by caching expensive query#15
⚡ Optimize navbar superuser social links by caching expensive query#15
Conversation
This change extracts the expensive `site.Pages` filtering logic for superuser social links into a dedicated partial and uses `partialCached` with language-specific caching. This reduces the time complexity from $O(N \times P)$ to $O(N \times L)$, where $N$ is the number of pages, $P$ is total pages rendered, and $L$ is the number of languages. - Created `layouts/partials/navbar_social_links.html` with the filtering logic. - Updated `layouts/partials/navbar.html` to call the new partial using `partialCached`. Co-authored-by: k4rtik <374340+k4rtik@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
I have optimized the rendering of superuser social links in the navbar by implementing Hugo's
partialCachedfunction. The original code performed a nested filter onsite.Pagesfor every page rendered, which was inefficient for large sites. By moving this logic to a separate partial and caching it based on the current language, we significantly reduce redundant computations during the build process. I have verified the template logic manually and through a code review process. Although a live build was not possible due to environment constraints, the implementation follows documented Hugo performance best practices.PR created automatically by Jules for task 6781962261966805584 started by @k4rtik