davestewart / nuxt-content-assets

Enable locally-located assets in Nuxt Content
https://npmjs.com/package/nuxt-content-assets
108 stars 7 forks source link

Allow passing query parameters #41

Open helltraitor opened 12 months ago

helltraitor commented 12 months ago

Background

Hello, now I try to add implementation for unified content for my blog. That can be possible via query in link that will allow me to use video, image and audio in one component.

![Text](media/file.mp4?type=video "Alternative text")

But for now that is not working out-of-the-box, and I get broken image icon. The thing is part with post route is not appended:

// REAL
http://localhost:3000/media/yara.jpeg?type=video

// EXPECTED
http://localhost:3000/posts/2023-07-30-en-content-assets/media/yara.jpeg?type=video

Proposal

Allow to pass query parameters (maybe strip before processing and applied it after)

Notes

Windows forbid to use ? as part of a valid path (same for multiplatform path), so that is fine to allow it as option (at least)

Current workarounds is:

  1. Scan alter text (e.g. I use text {metaKey=metaValue, ...}
  2. Append current route to url (which is obviously worse then 1)

I hope that you understand what I mean and why I need it. P.S. It's would be cool to have unified content links in Markdown spec (not only as custom extension)

davestewart commented 11 months ago

Hello!

Yes, this should absolutely be supported, and should be an easy fix.

Let me take a look in the next few days.

Thanks for reporting!

davestewart commented 9 months ago

OK, had a stab at this tonight, and looks like it's there:

image

Hang tight and I'll test and release

davestewart commented 2 months ago

Sorry – just checking in.

Sep - Dec last year turned into crazy work months.

I just spent some time in the last few weeks updating NCA, and this code is stashed but I'll look to find the time to merge it.

Thanks for your patience.