Skip to content

generate once, load many #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025
Merged

Conversation

stockholmux
Copy link
Member

Description

When the side bar was added to the command page it caused a massive increase in build times (see #321). This was caused by each command page needing to pull every command JSON file into to generate the list.

This PR takes a different approach, it adds a page (/command-list/), that is generated once, which contains the all the commands formatted as list items. Then, on each command page, it pulls that content in with some simple javascript.

Full build times were previously taking 40-70 seconds. After this change, the build times are taking approximately 1.2 seconds.

Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 564 pages (0 orphan) and 8 sections
Warning: Highlight language plaintext not found
Done in 1.2s.

Issues Resolved

#321

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License.

Signed-off-by: Kyle J. Davis <[email protected]>
@stockholmux stockholmux requested a review from madolson as a code owner August 7, 2025 21:20
@stockholmux
Copy link
Member Author

I'll also add that this is vastly better for SEO which will ignore the hundreds of links now being included by JS.

Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer it to be built statically, but I don't feel strongly.

@stockholmux
Copy link
Member Author

@madolson Yeah, I think that's the idiomatic way to think about this site, but this is a case where a dynamic inclusion on the front-end is the right choice: it rarely changes (so cached by the browser), it takes almost no logic to include or parse, and it's 45x faster to build plus the SEO bit, usually a downside of dynamic inclusion, but 400+ links in a sidebar will just confuse a crawler.

@stockholmux stockholmux merged commit 8fe3f57 into valkey-io:main Aug 7, 2025
3 checks passed
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.

2 participants