Skip to content

Conversation

@mnocon
Copy link
Contributor

@mnocon mnocon commented Jan 14, 2026

Currently, the PHP API reference takes more than 8gb on the disk. With MkDocs build, it's another 8 gb in the site directory -> more than 16gb for a single copy of the doc.

Very often I work on multiple PRs in parallel and I'm running out of disk space to continue some topics.

This also results in slower checkout and clone times when working with the doc.

The size of the repository is caused by our PHP API reference - 3k files, each almost 3mb in size, results in ~8gb of content (that gets doubled after MkDocs built).

This solution extract the common part of each file (the navigation) to a separate file that is loaded using JavaScript.

Advantages:

  • repository size is reduced, improving the experience of working with the doc
  • PHP API reference PRs start being reviewable and no longer exceed GitHub file limits, making it actually possible to see what has been changed

Disclaimer: I have used AI when writing the code, but I've verified the output (both of the script and the end result) and it works.

When reviewing, review 38bc22b first - and then verify the second commit locally (it's autogenerated).

Link to PHP API ref: https://ez-systems-developer-documentation--3008.com.readthedocs.build/en/3008/api/php_api/php_api_reference/

Individual file before:
https://github.com/ibexa/documentation-developer/blob/5.0/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-ActivityLog-Values-ActivityLog-Criterion-LogicalAnd.html

Individual file after:
https://github.com/ibexa/documentation-developer/blob/optimize-php-api-ref/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-ActivityLog-Values-ActivityLog-Criterion-LogicalAnd.html

(becomes actually viewable on GitHub)

============================================================

Navigation extraction complete!

============================================================

Files processed: 3202

Navigation file: docs/api/php_api/php_api_reference/shared-navigation.html

Navigation size: 2,484,805 bytes (2.37 MB)

Original total size: 8,006,126,043 bytes (7.46 GB)

Modified total size: 95,471,198 bytes (0.09 GB)

Tested scenarios:

  1. Navigation works for namespaces - ✅
  2. Navigation works for classes - ✅
  3. Navigation works for the index file - ✅
  4. Navigation works for the error report file - ✅
  5. Scroll position is saved when navigating - ✅
  6. The currently selected file is correctly highlighted - ✅
  7. The message with disabled JS is correct - ✅
  8. The loading message is displayed correctly - ✅
  9. The error message is correct in case of network error - ✅
Screenshot 2026-01-14 at 19 22 43 Screenshot 2026-01-14 at 19 21 17 Screenshot 2026-01-14 at 19 18 40

@github-actions
Copy link

Preview of modified files

Preview of addition to PHP API Reference:

@mnocon mnocon force-pushed the optimize-php-api-ref branch from 7fa2c8a to 0a03838 Compare January 14, 2026 18:24
@mnocon mnocon marked this pull request as ready for review January 15, 2026 07:32
@mnocon mnocon requested a review from adriendupuis January 15, 2026 07:32
@mnocon mnocon force-pushed the optimize-php-api-ref branch from 0a03838 to d88537c Compare January 15, 2026 07:35
@mnocon mnocon force-pushed the optimize-php-api-ref branch from d88537c to 473ecc4 Compare January 15, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant