davsclaus opened a new pull request, #1887:
URL: https://github.com/apache/camel-website/pull/1887
Refs #1879. This covers the script, font and image-markup parts of the
ticket. The GIF-to-video conversion and the image-size check are listed under
follow-ups below.
## Analysis
- **highlight.js:** `highlight.bundle.js` required the full build and then
registered 9 languages by hand, which did nothing because the full build
already includes every language. To decide which languages to keep I counted
the `[source,LANG]` blocks in the Antora content sources (camel, camel-quarkus,
camel-k, camel-kafka-connector, camel-kamelets, camel-spring-boot, camel-karaf)
and the fenced code blocks in `content/`:
- Most used: java 12k, xml 8.9k, yaml 7.6k, bash 1.3k, properties 1.2k,
json 282, shell 198, console 98, sql 46.
- Also used: groovy, go, powershell, javascript, css, html, gradle,
makefile, protobuf, python, rust, graphql, markdown, dockerfile, cmd, and
others.
- **DocSearch:** the search box is set up by `08-docsearch.js` inside
`site.js`, from a `DOMContentLoaded` listener that bails out if
`window.docsearch` is missing.
- **svg4everybody:** it is only a polyfill for external `<use>` references
in IE11 and old Edge. Every supported browser handles `<use href="…svg#id">`
natively.
- **Fonts:** only Open Sans still declared `.woff` fallbacks. Archivo and
JetBrains Mono were already `.woff2` only.
- **Images:**
- Of 452 Markdown images, 452 are relative page-bundle paths, 13 are
site-absolute and 1 is remote. None of them had `width`, `height` or `loading`.
- Two of the three largest GIFs in the ticket (`karavan-tour.gif` 15 MB
and `karavan-add-to-step.gif` 9.6 MB) belong to `draft: true` posts. Hugo never
publishes them, so they only make the repo bigger, not the site.
- The large GIFs that do ship are `kaoto-release-2.8.0/what-is-new.gif`
(9.4 MB), `camel417-whatsnew/cli-get-history.gif` (4.7 MB),
`kaoto-release-2.3.0/appendStep.gif` (3.1 MB) and
`camel-karavan-4.4.0/set-property.gif` (3.0 MB).
## Changes
- **highlight.js:** `require('highlight.js/lib/core')` plus 24 registered
languages. Aliases are covered by the language that declares them, for example
`sh` and `zsh` by bash, `console` by shell, `html` by xml, `yml` by yaml and
`js` by javascript. A block in an unregistered language is left as plain text
(hljs safe mode) instead of throwing.
- **DocSearch:** `<script defer>` on both the Antora (`footer-scripts.hbs`)
and Hugo (`footer.html`) pages. `site.js` still runs first and registers its
listener. Deferred scripts run before `DOMContentLoaded`, so `window.docsearch`
is defined when the listener fires.
- **New `layouts/_default/_markup/render-image.html`:**
- Raster page-bundle images (png, jpeg, gif, webp) get their intrinsic
`width`/`height`. The blog CSS keeps `width: auto; height: auto`, so the
attributes only reserve the aspect ratio.
- Every image after the first gets `loading="lazy"`, and all images get
`decoding="async"`.
- Remote, `/…` and SVG images keep the plain `<img>`.
- `src` is unchanged.
- **Removed** the svg4everybody bundle, its dependency and both script tags.
- **Fonts:** removed the Open Sans `.woff` fallbacks and added `<link
rel="preload">` for `open-sans-latin-ext-400.woff2`, the body face, in both
heads.
- **Rebuilt** the committed `antora-ui-camel/public` bundle.
## Verification
- **Sizes** (`gulp bundle` before and after):
| File | Before | After |
|---|---|---|
| `js/vendor/highlight.js` | 965,317 B raw / 304,574 B gz | **83,929 B raw
/ 27,974 B gz** |
| `js/vendor/svg4everybody.js` | 1,952 B raw / 1,042 B gz | removed |
| `ui-bundle.zip` | 1,076,081 B | 545,866 B |
- **UI theme:** `gulp lint`, `gulp test` and `gulp bundle` pass.
- **Root checks:** `yarn test` passes (23/23) and `yarn check:dependencies`
passes.
- **Hugo build** (`tests/hugo/build.sh`, Hugo 0.121.2): 0 errors.
- **Before/after diff of all 1,031 built HTML pages**, after normalising the
expected script, preload and asset-hash changes:
- The only remaining differences are in 7 pages: alt text now contains `’`
where it used to contain `’`, and `+` where it used to contain `+`.
Both render identically.
- Plus one nondeterministic title on `/releases/k-1.11.0/` that was
already there before this change.
- **Image hook output:**
- 271 Markdown images go through the hook.
- 235 now carry `width`/`height`. The rest are SVG, `static/` or remote
images.
- 199 are lazy.
- **Headless Chrome on the built site:**
- Code blocks highlight for yaml/java/properties (259 `hljs-*` spans), xml
(222), sh (200) and console (35), with no "Could not find the language"
warnings.
- The DocSearch button renders, so the deferred init works.
- **html-validate:** the rule counts are identical before and after on blog
2024–2026, `/community/` and the home page.
## Follow-ups (not in this PR)
- Convert the shipped large GIFs to `<video autoplay muted loop
playsinline>`. ffmpeg was not available where I made this change.
- Delete or move the assets of the draft Karavan posts, if those posts will
never be published.
- Resize or convert page-bundle images to webp in the render hook. This
needs a build-time and cache-size measurement first. The 13 site-absolute and
`static/` images (book covers, logos) are not handled by the hook.
- Add a CI check that flags new images over ~500 KB, with an allowlist for
the existing ones.
- Optionally skip loading `highlight.js` on Hugo pages without code blocks.
At 28 KB gzipped this matters much less now.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_016Y4dDj46SB6GniXf8mX2U6
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]