Image resize for Hugo

I tried uploading and inserting an image here:
https://cms-foobar.netlify.app/blog/2020-04-23-brand-new-test/

Obviously the 2M image needs to be processed…

However IIUC hugo doesn’t faciliate image processing from static?


Where can we go from here?!

There doesn’t appear to be a way to disable media uploads… is there?

Hi @kaihendry I posted a full example in a comment to that issue:

cms.js:

CMS.registerMediaLibrary({
  name: 'disabled',
  init: () => ({ show: () => undefined, enableStandalone: () => false }),
});

config.yml:

media_library:
  name: 'disabled'
1 Like

What if I don’t want to create my own https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js bundle?

Btw, is there a way to reference the latest netlify-cms.js so I get automatic upgrades?

Many thanks!

Hi @kaihendry, this should work:

<script>
  window.CMS_MANUAL_INIT = true;
</script>
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
<script>
  CMS.registerMediaLibrary({
    name: 'disabled',
    init: () => ({ show: () => undefined, enableStandalone: () => false }),
  });
  CMS.init();
</script>

Since you’re using netlify-cms@^2.0.0 (note the caret) you’ll get automatic upgrades for any new version that is not a major one.

Thanks! Is there a way to test this change locally? e.g. from http://localhost:1314/admin/#/


I committed the change already and now Preview links don’t appear for me… sorry, the Preview links have reappeared. Is there a way to better track builds? Seems a bit opaque right now.

Hi @kaihendry, you can test locally via https://www.netlifycms.org/docs/beta-features/#working-with-a-local-git-repository.
Also, for git-gateway to work locally you’ll need to set the proper netlifySiteURL for your site in local storage. There might be an old version of it - you can try clearing the browser cache and refreshing.
For preview links to appear a deploy has to at least start running on Netlify side otherwise the CMS has no way of knowing if there might be a preview link available.

But this feedback whether it’s running seems a bit unstable for me. Sometimes there is no notification.

We might need to look into using the Netlify API to figure out if there is a deploy pending in order to get more visibility for the preview links instead of just using commit statues. That would only work when hosting on Netlify though, but might still be better.