Skip to content

⚡ Optimize navbar superuser social links by caching expensive query#15

Open
k4rtik wants to merge 1 commit intomainfrom
perf-optimize-navbar-social-links-6781962261966805584
Open

⚡ Optimize navbar superuser social links by caching expensive query#15
k4rtik wants to merge 1 commit intomainfrom
perf-optimize-navbar-social-links-6781962261966805584

Conversation

@k4rtik
Copy link
Copy Markdown
Member

@k4rtik k4rtik commented Apr 3, 2026

I have optimized the rendering of superuser social links in the navbar by implementing Hugo's partialCached function. The original code performed a nested filter on site.Pages for 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

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>
@google-labs-jules
Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@k4rtik k4rtik marked this pull request as ready for review April 3, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant