danurbanowicz / eleventy-netlify-boilerplate

A template for building a simple website with the Eleventy static site generator

Home Page:https://eleventy-netlify-boilerplate.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bulky netlify-identity-widget script include

wachunga opened this issue · comments

netlify-identity-widget.js is adding 184kb (unminified) js to each page. Is it possible to restrict that to only necessary pages?
https://github.com/danurbanowicz/eleventy-netlify-boilerplate/blob/master/_includes/components/head.njk#L6

I like to keep the page weight low :)

image

Thanks for this.

I absolutely agree with you, and I had the same concerns back when the PR including this behaviour was made by the big boss of Netlify himself 😨 but there didn't actually seem to be a good way around it at the time.

I think it's there because of the way Netlify Identity works on invite signups, but if you have any ideas on how it could be offloaded from the frontend, I'm all ears!

Possible alternatives to loading the Identity widget on every single page, could be to either:-

Load the widget only on the site's root / e.g.

_includes/components/head.njk

{% if page.url == "/" %}
  <script async src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
{% endif %}

or set up Netlify Identity email templates, modifying the Identity invite email link to point to somewhere like /admin/index.html or perhaps a separate page where you load the Identity widget.

Closing this for now but I will re-open if there is still interest in the issue.

Thanks, that works.

ezoic increase your site revenue