CodeYourFuture / syllabus

Syllabus Website for CodeYourFuture
https://syllabus.codeyourfuture.io
153 stars 124 forks source link

Images in "remote" repos with relative URLs aren't rendered correctly #720

Closed 40thieves closed 11 months ago

40thieves commented 11 months ago

Describe the bug

If an image is included in a "remote" repo (e.g. in the workshop repo) that has a relative path (i.e. is not an absolute path) then the image is correctly rendered in the output and 404s.

From what I understand from @SallyMcGrath, this is because we are replacing absolute Github URLs with JSDelivr CDN URLs (as Github don't allow hotlinking). However this does not work if a relative path is used instead.

Unfortunately I now can't link to an example of this happening as @Dedekind561 fixed it 😆

How could this be fixed?

It sounds like there are two options:

  1. Look for relative links in the render hook, and rewrite them to the appropriate CDN URL
  2. Add a build step that pulls the images directly into build, and then wires them through Hugo Pipes

Who else might need to know about this?

@CodeYourFuture/global-syllabus

40thieves commented 11 months ago

I was initially thinking that option 2 would potentially blow up this repo with images, but on reflection I think this would only affect the build cache?

40thieves commented 11 months ago

🤦🏻‍♂️ I've just realised that I opened this on the wrong repo...