Skip to content

[hugo] fix(converter): bundle nested meshesYouLearn imagepath values - #8641

Closed
hiyach28 wants to merge 2 commits into
hugofrom
fix/hugo-learn-imagepath
Closed

hiyach28 wants to merge 2 commits into
hugofrom
fix/hugo-learn-imagepath

Conversation

@hiyach28

@hiyach28 hiyach28 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #8636

Problem: IMAGE_KEY only matches top-level front-matter keys, so the indented imagepath entries in the learning-path meshesYouLearn lists were copied through as ../../../src/... paths. Those paths don't exist in the Hugo site, and no warning was raised.

Change: a NESTED_IMAGE_KEY handler in convertFrontMatter that bundles imagepath the same way cardImage is bundled. It keeps the indentation, quote style and trailing comma, so the flow-style YAML stays valid. A path it can't bundle raises the usual "outside the page bundle" warning.

Checked:

  • Converting content-learn now leaves 0 ../ imagepath values (17 before). Each icon is copied into its course bundle, e.g. imagepath: "meshery-logo-light.svg".
  • check-idempotency.mjs passes for content-learn (0 byte differences).
  • Regenerating CONVERTER_REPORT.md produces no changes.
  • New test for a bundled entry and an unbundlable one. The suite passes apart from normalizes /static/ prefix…, which fails the same way on hugo without this change (Windows path separator in the expected report).

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f0ccc24c-2994-4f14-b51f-119836f97cae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Hugo preview removed because the pull request was closed.

@sarajkrishnasingh sarajkrishnasingh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice focused fix for #8636, and the verification in the description is exactly what a reviewer wants to see: 0 remaining ../ imagepath values in content-learn (down from 17), idempotency passing, and the converter report unchanged.

The NESTED_IMAGE_KEY handler fits the existing IMAGE_KEY flow well: it keeps indentation, quote style, and the trailing comma so the flow-style YAML stays valid, and paths it cannot bundle still raise the usual outside-the-bundle warning. The new test covers both the bundled and the unbundlable case, including the single-quote style.

Checks are green here (DCO, both build checks, verify-urls). The one failing test you flagged (normalizes /static/ prefix...) fails the same way on hugo without this change, so it reads as pre-existing and unrelated.

One small suggestion, left inline: the new test creates a temp dir with fs.mkdtempSync and never removes it. Cleaning it up keeps repeated runs tidy.

Comment thread hugo/scripts/test/migrate-mdx.test.mjs Outdated
Comment on lines +2068 to +2069

test('nested meshesYouLearn imagepath values are bundled, and unbundlable ones warn', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Small cleanup: this temp dir is never removed. t.after keeps repeated runs tidy:

Suggested change
test('nested meshesYouLearn imagepath values are bundled, and unbundlable ones warn', () => {
test('nested meshesYouLearn imagepath values are bundled, and unbundlable ones warn', (t) => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'l5-imagepath-'));
t.after(() => fs.rmSync(tmp, { recursive: true, force: true }));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 345954d: the test takes t and removes its temp dir in t.after. Thanks!

IMAGE_KEY only matches top-level front-matter keys, so the indented imagepath entries inside the learning-path meshesYouLearn list were copied through as ../../../src/... paths that don't exist in the Hugo site. Bundle them like cardImage, keeping indentation, quotes and the trailing comma, and warn when one can't be bundled.

Fixes #8636

Signed-off-by: hiyach28 <hiyach28@gmail.com>
@hiyach28
hiyach28 force-pushed the fix/hugo-learn-imagepath branch from 92cec2f to a75fb62 Compare December 4, 2026 10:04
Signed-off-by: hiyach28 <hiyach28@gmail.com>
@hiyach28

hiyach28 commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

The failing build jobs aren't from this change. hugo itself has failed since the #8635 merge (d603924; the previous push, cbaba68, was green): js.Build failed: Could not resolve "@mui/x-date-pickers/LocalizationProvider" while rendering the sistent-demo shortcode in content/migration/sistent-spike/overview.md. @sistent/sistent 0.22.6 imports @mui/x-date-pickers as an optional peer dependency, and hugo/package.json doesn't install it. Every PR into hugo will fail until that's fixed on the base. This PR's converter tests, idempotency check and CONVERTER_REPORT freshness all pass locally.

@AliRana30 AliRana30 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM! Clean NESTED_IMAGE_KEY handling and solid test coverage with proper temp-dir cleanup.

@pontusringblom

Copy link
Copy Markdown
Contributor

This is a good item to add to the weekly Websites meeting agenda (meet.meshery.io/websites-minutes). You can add this item in the doc, attend, and present it. Meeting details can be found at https://meshery.io/calendar.

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.

5 participants